]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Clarify the behavior of any() and all() with an empty iterable.
authorRaymond Hettinger <python@rcn.com>
Thu, 16 Apr 2009 18:16:10 +0000 (18:16 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 16 Apr 2009 18:16:10 +0000 (18:16 +0000)
Doc/library/functions.rst

index 5ca6e4226e275e3fa89d82bc778e6aa1e23c93ae..a075afd06a908470cbbf7d39c917be6968596e26 100644 (file)
@@ -17,7 +17,8 @@ available.  They are listed here in alphabetical order.
 
 .. function:: all(iterable)
 
-   Return True if all elements of the *iterable* are true. Equivalent to::
+   Return True if all elements of the *iterable* are true (or if the iterable
+   is empty).  Equivalent to::
 
       def all(iterable):
           for element in iterable:
@@ -30,7 +31,8 @@ available.  They are listed here in alphabetical order.
 
 .. function:: any(iterable)
 
-   Return True if any element of the *iterable* is true. Equivalent to::
+   Return True if any element of the *iterable* is true.  If the iterable
+   is empty, return False.  Equivalent to::
 
       def any(iterable):
           for element in iterable: