diff options
author | Raymond Hettinger <python@rcn.com> | 2005-03-11 06:49:40 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-03-11 06:49:40 (GMT) |
commit | 96229b191814556622b575fd320e822f918f355a (patch) | |
tree | 3804d604b12aea8ea55a14816c853e9c130fc0ca /Doc/lib/libfuncs.tex | |
parent | 26e512a04f7b68684503d7afe21154b5dd392d6e (diff) | |
download | cpython-96229b191814556622b575fd320e822f918f355a.zip cpython-96229b191814556622b575fd320e822f918f355a.tar.gz cpython-96229b191814556622b575fd320e822f918f355a.tar.bz2 |
Add two new functions, any() and all().
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 6b853f3..9e387d9 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -60,6 +60,32 @@ def my_import(name): complex number, its magnitude is returned. \end{funcdesc} +\begin{funcdesc}{all}{iterable} + Return True if all elements of the \var{iterable} are true. + Equivalent to: + \begin{verbatim} + def all(iterable): + for element in iterable: + if not element: + return False + return True + \end{verbatim} + \versionadded{2.5} +\end{funcdesc} + +\begin{funcdesc}{any}{iterable} + Return True if any element of the \var{iterable} is true. + Equivalent to: + \begin{verbatim} + def any(iterable): + for element in iterable: + if element: + return True + return False + \end{verbatim} + \versionadded{2.5} +\end{funcdesc} + \begin{funcdesc}{basestring}{} This abstract type is the superclass for \class{str} and \class{unicode}. It cannot be called or instantiated, but it can be used to test whether |