[issue30965] Unexpected behavior of operator "in"

2017-07-19 Thread Mihai Cara
Mihai Cara added the comment: I am sure that some time ago I read that `in` is a comparison operator but I forgot it and I was thinking that (x in y) would be equivalent to (replaced with) the return value of y.__contains__(x). -- ___ Python

[issue30965] Unexpected behavior of operator "in"

2017-07-19 Thread Mihai Cara
Mihai Cara added the comment: Thank you! It was my fault: I was not expecting `in` to be a comparison operator. -- ___ Python tracker <http://bugs.python.org/issue30

[issue30965] Unexpected behavior of operator "in"

2017-07-18 Thread Mihai Cara
New submission from Mihai Cara: Unexpected behavior of operator "in" when checking if a list/tuple/etc. contains a value: >>> 1 in [1] is True False >>> (1 in [1]) is True True Is this a bug? If not, please explain why first variant return False. --