Assignment with "or" in python [closed]
Solution 1:
No, it's a common practice. It's only considered bad style for expressions that are considerably longer than yours.
Solution 2:
The primary danger of doing something like this is the possibility that (in the second case) some_variable
is False but not None (the integer 0
, for instance) and you don't want to end up with y
equal to None in that case.