This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stestagg
Recipients Mark.Shannon, Mohamed_Atef, ethan.furman, gregory.p.smith, gvanrossum, josh.r, pablogsal, serhiy.storchaka, stestagg
Date 2021-01-13.17:33:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610559239.46.0.0918953527951.issue42899@roundup.psfhosted.org>
In-reply-to
Content
Sounds great to me (with my approximately zero optimizer experience)

At risk of taking this too far, you /could/ add something like:

"skip any boolean test of a value _immediately_ following another boolean test, when it has no ..."

to this spec/guidance/whatever it is.

Just to prevent the risk of the `if` block being removed in future in ridiculous code like the following:

try:
  while True:
    a = x or y
    a.pop()
    if a:
      pass
except XIsEmptyError:
  ...

(I'm guessing we're pretty far from being able to rewrite enough for this to be a remotely credible optimization candidate anytime soon anyway)
History
Date User Action Args
2021-01-13 17:33:59stestaggsetrecipients: + stestagg, gvanrossum, gregory.p.smith, ethan.furman, Mark.Shannon, serhiy.storchaka, josh.r, Mohamed_Atef, pablogsal
2021-01-13 17:33:59stestaggsetmessageid: <1610559239.46.0.0918953527951.issue42899@roundup.psfhosted.org>
2021-01-13 17:33:59stestagglinkissue42899 messages
2021-01-13 17:33:59stestaggcreate