[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?
Mark Shannon
report at bugs.python.org
Tue Jan 12 11:39:25 EST 2021
Mark Shannon <mark at hotpy.org> added the comment:
> How do we know `x` is falsey without calling `bool()` on it?
We don't, but in `if x: pass`, it doesn't matter.
Discounting side-effects in __bool__, the code does nothing regardless of the value of `x`.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42899>
_______________________________________
More information about the Python-bugs-list
mailing list