any(), all() and empty iterable

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Thu Apr 16 17:43:45 EDT 2009


Dale Roberts schreef:
> On Apr 16, 2:27 pm, Tim Chase <python.l... at tim.thechases.com> wrote:
>> Raymond Hettinger wrote:
>>> I will not change the sentence to "return false if any element
>>> of the iterable is false."  The negations make the sentence
>>> hard to parse mentally
>> Just as a ribbing, that "return X if any element of the iterable
>> is X" is of the same form as the original.  The negation is only
>> of the X, not of the sentence structure.
>>
>>> 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.
> 

> [...] and simply adding something like "or the iterable is empty"
> might head off future confusion.

+1

-- 
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
  -- Isaac Asimov

Roel Schroeven



More information about the Python-list mailing list