Steve Stagg <stest...@gmail.com> added the comment:

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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42899>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to