mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Update the filter() and list() descriptions to include information about
the support for containers and iteration.
This commit is contained in:
parent
93656e76f9
commit
eacdec6b38
1 changed files with 14 additions and 12 deletions
|
@ -234,12 +234,13 @@ class instances are callable if they have a \method{__call__()} method.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{filter}{function, list}
|
\begin{funcdesc}{filter}{function, list}
|
||||||
Construct a list from those elements of \var{list} for which
|
Construct a list from those elements of \var{list} for which
|
||||||
\var{function} returns true. If \var{list} is a string or a tuple,
|
\var{function} returns true. \var{list} may be either a sequence, a
|
||||||
the result also has that type; otherwise it is always a list. If
|
container which supports iteration, or an iterator, If \var{list}
|
||||||
\var{function} is \code{None}, the identity function is assumed,
|
is a string or a tuple, the result also has that type; otherwise it
|
||||||
i.e.\ all elements of \var{list} that are false (zero or empty) are
|
is always a list. If \var{function} is \code{None}, the identity
|
||||||
removed.
|
function is assumed, i.e.\ all elements of \var{list} that are false
|
||||||
|
(zero or empty) are removed.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{float}{x}
|
\begin{funcdesc}{float}{x}
|
||||||
|
@ -378,12 +379,13 @@ raised.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{list}{sequence}
|
\begin{funcdesc}{list}{sequence}
|
||||||
Return a list whose items are the same and in the same order as
|
Return a list whose items are the same and in the same order as
|
||||||
\var{sequence}'s items. If \var{sequence} is already a list,
|
\var{sequence}'s items. \var{sequence} may be either a sequence, a
|
||||||
a copy is made and returned, similar to \code{\var{sequence}[:]}.
|
container that supports iteration, or an iterator object. If
|
||||||
For instance, \code{list('abc')} returns
|
\var{sequence} is already a list, a copy is made and returned,
|
||||||
returns \code{['a', 'b', 'c']} and \code{list( (1, 2, 3) )} returns
|
similar to \code{\var{sequence}[:]}. For instance,
|
||||||
\code{[1, 2, 3]}.
|
\code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list(
|
||||||
|
(1, 2, 3) )} returns \code{[1, 2, 3]}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{locals}{}
|
\begin{funcdesc}{locals}{}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue