any(), all() and empty iterable

John Posner jjposner at snet.net
Thu Apr 16 15:20:02 EDT 2009


Tim Chase wrote:
>> I will probably leave the lead-in sentence as-is but may
>> add another sentence specifically covering the case for
>> an empty iterable.
>
> as one of the instigators in this thread, I'm +1 on this solution.
>
Thanks for weighing in, Raymond. As long as people are getting in their 
last licks on this one ...

Including the word "all" in the definition of "all()" is suboptimal. 
Especially since the everyday meaning of "all" is ambiguous. Sure, leave 
in the code-equivalent to clarify things, but why not clarify in text, 
also? Here's a compromise:

  all(iterable) -- Return True if all elements of the /iterable/ are 
true -- more
  precisely, if there does not exist an element of the iterable that is 
False.
  Equivalent to ...




More information about the Python-list mailing list