How does Python parse the first of the following three expressions? (I expected it to be the same as the second, since == and in have the same priority.)
==
in
>>> 1 == 0 in (0,1), (1==0) in (0,1), 1 == (0 in (0,1)) (False, True, True)
See the documentation of comparison operators : they are constrained, not grouped. So, 1 == 0 in (0,1) equivalent to (1==0) and (0 in (0,1)) , which is obviously not true.
1 == 0 in (0,1)
(1==0) and (0 in (0,1))