My understanding of all()
is that it returns True
if every value if an iterable is True
when evaluated as a boolean.
bool([]) == False
, so why does all([])
return True
?
It's vacuously true. Since there's nothing in the list, there's no false elements in the list, and all
only returns False if at least one of its inputs is False. Since all zero elements in the list are true, all
returns True.