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 tim.peters
Recipients Dennis Sweeney, akuvfx, tim.peters
Date 2021-10-21.00:17:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634775460.84.0.834236778697.issue45542@roundup.psfhosted.org>
In-reply-to
Content
I think Dennis's example is fatal: from section 6.10 ("Comparisons"):

"""
Comparisons can be chained arbitrarily, e.g., `x < y <= z` is equivalent to `x < y and y <= z`, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false).
"""

So doing LOAD_FAST twice on x (in `1 < x < 3`) is prohibited by the language definition. Doesn't matter to this whether it's plain `x` or `f(x)` where `f()` is some arbitrary function: the object the middle comparand signifies is fixed at whatever it was when the the first comparison is evaluated.
History
Date User Action Args
2021-10-21 00:17:40tim.peterssetrecipients: + tim.peters, Dennis Sweeney, akuvfx
2021-10-21 00:17:40tim.peterssetmessageid: <1634775460.84.0.834236778697.issue45542@roundup.psfhosted.org>
2021-10-21 00:17:40tim.peterslinkissue45542 messages
2021-10-21 00:17:40tim.peterscreate