[issue45268] use multiple "in" in one expression?

Dennis Sweeney report at bugs.python.org
Thu Sep 23 02:19:24 EDT 2021


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

This is the expected behavior, documented here: https://docs.python.org/3/reference/expressions.html#comparisons


That page says:

    * The comparison operators are  "<" | ">" | "==" | ">=" | "<=" | "!=" | "is" ["not"] | ["not"] "in"

    * "Comparisons can be chained arbitrarily"

    * "Note that a op1 b op2 c doesn’t imply any kind of comparison between a and c, so that, e.g., x < y > z is perfectly legal (though perhaps not pretty)."


So I'll close this for now.

I think it would be hard to change this behavior without introducing a needless backwards-incompatibility, but if you have a proposal, you could bring it up on the Python-Ideas mailing list.

----------
nosy: +Dennis Sweeney
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45268>
_______________________________________


More information about the Python-bugs-list mailing list