>>> 5 in [1, 2, 3, 4] == False
False
I get that this is a bizarre way to test membership, and that
>>> 5 not in [1, 2, 3, 4]
True
is the "correct" way. What confuses me is that its behavior is different from both
>>> (5 in [1, 2, 3, 4]) == False
True
and
>>> 5 in ([1, 2, 3, 4] == False)
TypeError ...
Have I missed something obvious? (Tested in Python 2.7 and Python 3.4).
To clarify, I understand the last three snippets. I am asking about the behavior of the first snippet, and why it is different.