3 ms·
> Not in this case, but Yoda conditions can be useful. Not in Python. Assignments as anything but stand-alone (potentially chained) statements are syntax error
by masklinn 16y ago
> Not in this case, but Yoda conditions can be useful.
Not in Python. Assignments as anything but stand-alone (potentially chained) statements are syntax errors.
The parser will not let you write
if something = 2:
in the first place.
- acangiano 16y agoThat's why I said "not in this case". There are languages affected by this though (typically C-based ones). Ideally, their compiler will give you a warning about it, but that's not always the case.