Ammar Askar added the comment:

Check out this section of the documentation, notably this part:

"Note that comparisons, membership tests, and identity tests, all have the same 
precedence and have a left-to-right chaining feature"

Chaining lets you write stuff like this:

>>> x = 1
>>> 0 < x < 2
True

And since membership tests and identity tests are chained, the code you posted 
above essentially turns into:

(1 in [1]) and ([1] is True)

The former part of that expression is True but the latter is false.

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

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to