Message384919
The issue here is:
Is it legal to convert
if x: pass
into
pass
?
The explicit effect of the code is unchanged, BUT the implicit effect (of calling x.__bool__) is changed.
The examples Serhiy gives are similar. If `bool(a)` evaluates to False, then `bool(a and b)` must be False, so we skip testing `a and b`.
However, we do not know that `bool(a and b)` cannot have a side-effect, so the optimization could be incorrect w.r.t. side effects. |
|
Date |
User |
Action |
Args |
2021-01-12 11:22:31 | Mark.Shannon | set | recipients:
+ Mark.Shannon, gregory.p.smith, serhiy.storchaka, Mohamed_Atef, pablogsal, stestagg |
2021-01-12 11:22:31 | Mark.Shannon | set | messageid: <1610450551.07.0.179356143953.issue42899@roundup.psfhosted.org> |
2021-01-12 11:22:31 | Mark.Shannon | link | issue42899 messages |
2021-01-12 11:22:30 | Mark.Shannon | create | |
|