[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Tim Peters
Tim Peters added the comment: Orion, you're using the interface as intended :-) While it's too late to change now, if Python started over from scratch I'd argue to leave "in" and "not in" out of this feature - chaining them is _usually_ an unintended behavior. Then again, sometimes it is

[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Eryk Sun
Eryk Sun added the comment: For reference see the section on comparisons in the language reference: https://docs.python.org/3/reference/expressions.html#comparisons -- nosy: +eryksun resolution: -> not a bug ___ Python tracker

[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Orion Fisher
Orion Fisher added the comment: Ah, I see, thank you for the clear explanation. Chaining is so intuitive in the case it is always introduced with, yet I never knew it applied so generally. (New to the interface so I hope this is indeed where I must reply.) --

[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Orion Fisher
Change by Orion Fisher : -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Tim Peters
Tim Peters added the comment: "!=" and "in" are comparison operators in Python, and _all_ comparison operators "chain". That is, x < y < z means x < y and y < z (although y is evaluated only once), and in the same way True != True in [False, False] means True != True and True in

[issue39746] Inappropriate short circuit relating to inequality comparison and membership test

2020-02-24 Thread Orion Fisher
New submission from Orion Fisher : I found a strange issue with how the interpreter produces bytecode for an expression like True != True in [False, False]. Reading it, one would expect the value of the expression to be True, whether the inequality comparison is evaluated first, or the