Ternary Operation 三元運算子

is, is not

a = []
b = []
print(a is b)
# False
c = None
print(c is None)
# True

in, not in

2 in [2,3]
# True
4 in [2,3]
# False

Function

any(), not any()

any([0,0,0])
# False
any([0,0,1])
# True
any([0,1,1])
# True
any([1,1,1])
# True

實際應用:

a = [1,2,3]
any(e == 1 for e in a)
# True

all(), not all()