This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients Sreenivasulu Saya, steven.daprano, tim.peters
Date 2015-09-29.04:12:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443499976.98.0.41772616826.issue25261@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-09-29 04:12:57tim.peterssetrecipients: + tim.peters, steven.daprano, Sreenivasulu Saya
2015-09-29 04:12:56tim.peterssetmessageid: <1443499976.98.0.41772616826.issue25261@psf.upfronthosting.co.za>
2015-09-29 04:12:56tim.peterslinkissue25261 messages
2015-09-29 04:12:56tim.peterscreate