问题
>>> a = 2
>>> b = 3
>>> c = 2
>>> b > a == c
True
>>>
Is this true that b > a == c
is equal to a < b and c == a
because it's a chained comparison?
This doesn't make sense to me because of ==
comparison, I would expect that b > a == c
is equal to (b > a) == c
or b > (a == c)
.
回答1:
python is correcting your comparison automatically with if (b>a) AND (a==c)
来源:https://stackoverflow.com/questions/58084423/strange-chained-comparison