Mark Shannon <m...@hotpy.org> added the comment:
The problem with using a specific syntax example, is that the optimizer doesn't work that way. It works on the CFG. Any specification needs to be phrased in terms of general control flow, as other optimizations can enable this transformation. e.g. if x or True: do_something() is (in master) transformed to: x do_something() I think your earlier suggestion of "So I think dropping an *extra* call is fine, while dropping the *only* call is not." is the best way to preserve 3.9 behavior. It can be formalised as: "The implementation is allowed to skip any boolean tests of a value, when it has effect on the flow of the program and at least one test has already been performed on that value." ---------- _______________________________________ 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