On Thu, Oct 1, 2015 at 12:37 PM, Steven D'Aprano email@example.com wrote:
This makes a difference. Just a few days ago, somebody mis-reported a supposed "bug" in all() and any(). For example:
values = (x%5 == 3 for x in range(8)) print(list(values)) print(all(values)) # should return False
Obvious error is obvious: having printed out the values from the generator expression, values is now exhausted, and all() of the empty set is True (vacuous truth). The difference between general iterables which may or may not be one-shot iterators, and those which are definitely not iterators, is not always just an implementation detail.
they used a generator expression, when they clearly wanted a list comprehension -- so yes, it matters what they were getting, I don't know that adding more vocabulary would help prevent people from making that mistake...
if they had been smart enough to call the list() again, before claiming there was a bug in all -- it may have explained itself.
-- Steve _______________________________________________ Python-ideas mailing list Pythonfirstname.lastname@example.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/