From: Raymond Hettinger Date: Thu, 16 Apr 2009 18:16:10 +0000 (+0000) Subject: Clarify the behavior of any() and all() with an empty iterable. X-Git-Tag: v2.7a1~1467 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76162e305cedb4b332a6804df815044f297b4e95;p=thirdparty%2FPython%2Fcpython.git Clarify the behavior of any() and all() with an empty iterable. --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 5ca6e4226e27..a075afd06a90 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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: