mirror of https://github.com/python/cpython.git
Some other built-in functions are described with 'sequence' arguments
that should really be 'iterable'; this commit changes them. Did I miss any? Did I introduce any errors?
This commit is contained in:
parent
b688573766
commit
a490d59fbb
|
@ -237,11 +237,11 @@ class C:
|
||||||
\code{del \var{x}.\var{foobar}}.
|
\code{del \var{x}.\var{foobar}}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{dict}{\optional{mapping-or-sequence}}
|
\begin{funcdesc}{dict}{\optional{arg}}
|
||||||
Return a new dictionary initialized from an optional positional
|
Return a new dictionary initialized from an optional positional
|
||||||
argument or from a set of keyword arguments.
|
argument or from a set of keyword arguments.
|
||||||
If no arguments are given, return a new empty dictionary.
|
If no arguments are given, return a new empty dictionary.
|
||||||
If the positional argument is a mapping object, return a dictionary
|
If the positional argument \var{arg} is a mapping object, return a dictionary
|
||||||
mapping the same keys to the same values as does the mapping object.
|
mapping the same keys to the same values as does the mapping object.
|
||||||
Otherwise the positional argument must be a sequence, a container that
|
Otherwise the positional argument must be a sequence, a container that
|
||||||
supports iteration, or an iterator object. The elements of the argument
|
supports iteration, or an iterator object. The elements of the argument
|
||||||
|
@ -414,18 +414,18 @@ class C:
|
||||||
\versionadded{2.2}
|
\versionadded{2.2}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{filter}{function, list}
|
\begin{funcdesc}{filter}{function, iterable}
|
||||||
Construct a list from those elements of \var{list} for which
|
Construct a list from those elements of \var{iterable} for which
|
||||||
\var{function} returns true. \var{list} may be either a sequence, a
|
\var{function} returns true. \var{iterable} may be either a sequence, a
|
||||||
container which supports iteration, or an iterator, If \var{list}
|
container which supports iteration, or an iterator, If \var{iterable}
|
||||||
is a string or a tuple, the result
|
is a string or a tuple, the result
|
||||||
also has that type; otherwise it is always a list. If \var{function} is
|
also has that type; otherwise it is always a list. If \var{function} is
|
||||||
\code{None}, the identity function is assumed, that is, all elements of
|
\code{None}, the identity function is assumed, that is, all elements of
|
||||||
\var{list} that are false are removed.
|
\var{iterable} that are false are removed.
|
||||||
|
|
||||||
Note that \code{filter(function, \var{list})} is equivalent to
|
Note that \code{filter(function, \var{iterable})} is equivalent to
|
||||||
\code{[item for item in \var{list} if function(item)]} if function is
|
\code{[item for item in \var{iterable} if function(item)]} if function is
|
||||||
not \code{None} and \code{[item for item in \var{list} if item]} if
|
not \code{None} and \code{[item for item in \var{iterable} if item]} if
|
||||||
function is \code{None}.
|
function is \code{None}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
@ -591,12 +591,12 @@ class C:
|
||||||
may be a sequence (string, tuple or list) or a mapping (dictionary).
|
may be a sequence (string, tuple or list) or a mapping (dictionary).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{list}{\optional{sequence}}
|
\begin{funcdesc}{list}{\optional{iterable}}
|
||||||
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. \var{sequence} may be either a sequence, a
|
\var{iterable}'s items. \var{iterable} may be either a sequence, a
|
||||||
container that supports iteration, or an iterator object. If
|
container that supports iteration, or an iterator object. If
|
||||||
\var{sequence} is already a list, a copy is made and returned,
|
\var{iterable} is already a list, a copy is made and returned,
|
||||||
similar to \code{\var{sequence}[:]}. For instance,
|
similar to \code{\var{iterable}[:]}. For instance,
|
||||||
\code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list(
|
\code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list(
|
||||||
(1, 2, 3) )} returns \code{[1, 2, 3]}. If no argument is given,
|
(1, 2, 3) )} returns \code{[1, 2, 3]}. If no argument is given,
|
||||||
returns a new empty list, \code{[]}.
|
returns a new empty list, \code{[]}.
|
||||||
|
@ -622,22 +622,22 @@ class C:
|
||||||
are given, returns \code{0L}.
|
are given, returns \code{0L}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{map}{function, list, ...}
|
\begin{funcdesc}{map}{function, iterable, ...}
|
||||||
Apply \var{function} to every item of \var{list} and return a list
|
Apply \var{function} to every item of \var{iterable} and return a list
|
||||||
of the results. If additional \var{list} arguments are passed,
|
of the results. If additional \var{iterable} arguments are passed,
|
||||||
\var{function} must take that many arguments and is applied to the
|
\var{function} must take that many arguments and is applied to the
|
||||||
items of all lists in parallel; if a list is shorter than another it
|
items from all iterables in parallel. If one iterable is shorter than another it
|
||||||
is assumed to be extended with \code{None} items. If \var{function}
|
is assumed to be extended with \code{None} items. If \var{function}
|
||||||
is \code{None}, the identity function is assumed; if there are
|
is \code{None}, the identity function is assumed; if there are
|
||||||
multiple list arguments, \function{map()} returns a list consisting
|
multiple arguments, \function{map()} returns a list consisting
|
||||||
of tuples containing the corresponding items from all lists (a kind
|
of tuples containing the corresponding items from all iterables (a kind
|
||||||
of transpose operation). The \var{list} arguments may be any kind
|
of transpose operation). The \var{iterable} arguments may be a sequence
|
||||||
of sequence; the result is always a list.
|
or any iterable object; the result is always a list.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{max}{s\optional{, args...}\optional{key}}
|
\begin{funcdesc}{max}{iterable\optional{, args...}\optional{key}}
|
||||||
With a single argument \var{s}, return the largest item of a
|
With a single argument \var{iterable}, return the largest item of a
|
||||||
non-empty sequence (such as a string, tuple or list). With more
|
non-empty iterable (such as a string, tuple or list). With more
|
||||||
than one argument, return the largest of the arguments.
|
than one argument, return the largest of the arguments.
|
||||||
|
|
||||||
The optional \var{key} argument specifies a one-argument ordering
|
The optional \var{key} argument specifies a one-argument ordering
|
||||||
|
@ -647,9 +647,9 @@ class C:
|
||||||
\versionchanged[Added support for the optional \var{key} argument]{2.5}
|
\versionchanged[Added support for the optional \var{key} argument]{2.5}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{min}{s\optional{, args...}\optional{key}}
|
\begin{funcdesc}{min}{iterable\optional{, args...}\optional{key}}
|
||||||
With a single argument \var{s}, return the smallest item of a
|
With a single argument \var{iterable}, return the smallest item of a
|
||||||
non-empty sequence (such as a string, tuple or list). With more
|
non-empty iterable (such as a string, tuple or list). With more
|
||||||
than one argument, return the smallest of the arguments.
|
than one argument, return the smallest of the arguments.
|
||||||
|
|
||||||
The optional \var{key} argument specifies a one-argument ordering
|
The optional \var{key} argument specifies a one-argument ordering
|
||||||
|
@ -871,17 +871,17 @@ class Parrot(object):
|
||||||
line editing and history features.
|
line editing and history features.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{reduce}{function, sequence\optional{, initializer}}
|
\begin{funcdesc}{reduce}{function, iterable\optional{, initializer}}
|
||||||
Apply \var{function} of two arguments cumulatively to the items of
|
Apply \var{function} of two arguments cumulatively to the items of
|
||||||
\var{sequence}, from left to right, so as to reduce the sequence to
|
\var{iterable}, from left to right, so as to reduce the iterable to
|
||||||
a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2,
|
a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2,
|
||||||
3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. The left argument,
|
3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. The left argument,
|
||||||
\var{x}, is the accumulated value and the right argument, \var{y},
|
\var{x}, is the accumulated value and the right argument, \var{y},
|
||||||
is the update value from the \var{sequence}. If the optional
|
is the update value from the \var{iterable}. If the optional
|
||||||
\var{initializer} is present, it is placed before the items of the
|
\var{initializer} is present, it is placed before the items of the
|
||||||
sequence in the calculation, and serves as a default when the
|
iterable in the calculation, and serves as a default when the
|
||||||
sequence is empty. If \var{initializer} is not given and
|
iterable is empty. If \var{initializer} is not given and
|
||||||
\var{sequence} contains only one item, the first item is returned.
|
\var{iterable} contains only one item, the first item is returned.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{reload}{module}
|
\begin{funcdesc}{reload}{module}
|
||||||
|
@ -1121,11 +1121,11 @@ class C(B):
|
||||||
\versionadded{2.2}
|
\versionadded{2.2}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{tuple}{\optional{sequence}}
|
\begin{funcdesc}{tuple}{\optional{iterable}}
|
||||||
Return a tuple whose items are the same and in the same order as
|
Return a tuple whose items are the same and in the same order as
|
||||||
\var{sequence}'s items. \var{sequence} may be a sequence, a
|
\var{iterable}'s items. \var{iterable} may be a sequence, a
|
||||||
container that supports iteration, or an iterator object.
|
container that supports iteration, or an iterator object.
|
||||||
If \var{sequence} is already a tuple, it
|
If \var{iterable} is already a tuple, it
|
||||||
is returned unchanged. For instance, \code{tuple('abc')} returns
|
is returned unchanged. For instance, \code{tuple('abc')} returns
|
||||||
\code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
|
\code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
|
||||||
\code{(1, 2, 3)}. If no argument is given, returns a new empty
|
\code{(1, 2, 3)}. If no argument is given, returns a new empty
|
||||||
|
|
Loading…
Reference in New Issue