Pythonは連鎖比較で特別なことを行います。
以下の評価は異なります。
x > y > z # in this case, if x > y evaluates to true, then
# the value of y is being used to compare, again,
# to z
(x > y) > z # the parenth form, on the other hand, will first
# evaluate x > y. And, compare the evaluated result
# with z, which can be "True > z" or "False > z"
ただし、どちらの場合でも、最初の比較がの場合False、ステートメントの残りの部分は確認されません。
あなたの特定のケースでは、
1 in [] in 'a' # this is false because 1 is not in []
(1 in []) in a # this gives an error because we are
# essentially doing this: False in 'a'
1 in ([] in 'a') # this fails because you cannot do
# [] in 'a'
また、上記の最初のルールを示すために、これらはTrueと評価されるステートメントです。
1 in [1,2] in [4,[1,2]] # But "1 in [4,[1,2]]" is False
2 < 4 > 1 # and note "2 < 1" is also not true
Python演算子の優先順位:http : //docs.python.org/reference/expressions.html#summary
if a < b < c:それを書いて直感的に動作させることができるもの