Comparisons can be chained arbitrarily, e.g., 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).
Formally, if a, b, c, ..., y, z are expressions and op1, op2, ..., opN are comparison operators, then a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z, except that each expression is evaluated at most once.
是的,如documentation中所述:
因此您可以链接任何类型的比较器:
<
、>
、==
、>=
、<=
、<>
、!=
、is [not]
和[not] in
。你知道吗文件进一步使其更加正式:
例如:
相当于:
相关问题 更多 >
编程相关推荐