Light Mode
Dark Mode
Functions any() and all() on empty list.

Hello everybody, I have just encountered strange behaviour of python built-in function all.

Consider:

data = list() #empty list

any(data) == False # it is True. OK to me.

all(data) == False # it is False!!! I would expect True as well

It make no sense to me. If any(data) is False how can be all(data) True?

It seems to me like total bug. Am I wrong?

Created: Aug. 22, 2014, 9:11 a.m.
Updated: Aug. 28, 2014, 6:19 a.m.
2
21
User avatar
hanpari