Chaining “is” operators
问题 Does python support chaining is operators, such as the following? a = None b = None a is b is None This outputs True , some doc references would be nice. 回答1: Yes. Any operators classified as comparisons can be chained. From the language reference: 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. The