Tim Peters added the comment: You wholly consume the iterator after the first time you apply `list()` to it. Therefore both `any()` and `all()` see an empty iterator, and return the results appropriate for an empty sequence:
>>> multiples_of_6 = (not (i % 6) for i in range(1, 10)) >>> list(multiples_of_6) [False, False, False, False, False, True, False, False, False] >>> list(multiples_of_6) # note: the iterator is exhausted! [] >>> any([]) False >>> all([]) True ---------- nosy: +tim.peters resolution: -> not a bug stage: -> resolved _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25261> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com