mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Add two new functions, any() and all().
This commit is contained in:
parent
26e512a04f
commit
96229b1918
4 changed files with 129 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue