any(), all() and empty iterable

Jani Hakala jahakala at iki.fi
Mon Apr 20 10:31:44 EDT 2009


Raymond Hettinger <python at rcn.com> writes:

> FWIW, I wrote the docs.  The pure python forms were put in
> as an integral part of the documentation.  The first
> sentence of prose was not meant to stand alone.  It is a
> lead-in to the code which makes explicit the short-circuiting
> behavior and the behavior when the input is empty.
>
Someone else seems to have written "What's new in Python 2.5"
documention which states:

 "Two new built-in functions, any() and all(), evaluate whether an
  iterator contains any true or false values. any() returns True if any
  value returned by the iterator is true; otherwise it will return
  False. all() returns True only if all of the values returned by the
  iterator evaluate as true."

This description of all() doesn't seem to be correct.

> I will probably leave the lead-in sentence as-is but may
> add another sentence specifically covering the case for
> an empty iterable.
>
Does this change cover the documentation returned by help(all) and 
help(any)?

Jani Hakala



More information about the Python-list mailing list