3 ms·
It seems if you use '=' it leads to dangerous programming bugs[1], whereas ':=' somehow prevents those bugs? [1] https://effbot.org/pyfaq/why-can-t-i-use-an-as
by fooblitzky 7y ago
It seems if you use '=' it leads to dangerous programming bugs[1], whereas ':=' somehow prevents those bugs?
[1] https://effbot.org/pyfaq/why-can-t-i-use-an-assignment-in-an-expression.htm https://effbot.org/pyfaq/why-can-t-i-use-an-assignment-in-an...
- mintplant 7y agoIt's much easier to leave off one = when you meant == than it is to accidentally type :=
- dodobirdlord 7y agoIt's so that something like this remains invalid syntax, instead of an unpleasant accident. x = False if x = True: sadness()