It's true because for every element in the list, all 0 of them, they all are equal to 2.
You can think of all being implemented as:
def all(list, condition):
for a in list:
if not condition(a):
return false
return true
Whereas any is:
def any(list, condition):
for a in list:
if condition(a):
return true
return false
That is to say, all
is innocent until proven guilty, and any
is guilty until proven innocent.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…