Author Mark.Shannon
Recipients Mark.Shannon, Mohamed_Atef, gregory.p.smith, pablogsal, serhiy.storchaka, stestagg
Date 2021-01-12.11:22:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610450551.07.0.179356143953.issue42899@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-01-12 11:22:31Mark.Shannonsetrecipients: + Mark.Shannon, gregory.p.smith, serhiy.storchaka, Mohamed_Atef, pablogsal, stestagg
2021-01-12 11:22:31Mark.Shannonsetmessageid: <1610450551.07.0.179356143953.issue42899@roundup.psfhosted.org>
2021-01-12 11:22:31Mark.Shannonlinkissue42899 messages
2021-01-12 11:22:30Mark.Shannoncreate