我在笔记本电脑上尝试了一个表达式
3 > 2 == True
输出为
False
?
这称为链式比较。
来自文档:比较
比较可以任意链接,例如 x < y <= z is equivalent to x < y and y <= z, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false).
所以等式变为:
3 > 2 and 2 == True
True and False
False