I\'m making a Python parser, and this is really confusing me:
>>> 1 in [] in \'a\'
False
>>> (1 in []) in \'a\'
TypeError: \'in &
The short answer, since the long one is already given several times here and in excellent ways, is that the boolean expression is short-circuited, this is has stopped evaluation when a change of true in false or vice versa cannot happen by further evaluation.
(see http://en.wikipedia.org/wiki/Short-circuit_evaluation)
It might be a little short (no pun intended) as an answer, but as mentioned, all other explanation is allready done quite well here, but I thought the term deserved to be mentioned.