mirror of
https://github.com/python/cpython.git
synced 2024-11-25 10:54:51 +08:00
Rename enumerate() kw argument name to "iterable" and fix "sequence"->"iterable" in some docstrings.
This commit is contained in:
parent
1f2ba4b6da
commit
d11ae5d6ec
@ -325,9 +325,9 @@ are always available. They are listed here in alphabetical order.
|
||||
< abs(b)``.
|
||||
|
||||
|
||||
.. function:: enumerate(sequence[, start=0])
|
||||
.. function:: enumerate(iterable[, start=0])
|
||||
|
||||
Return an enumerate object. *sequence* must be a sequence, an
|
||||
Return an enumerate object. *iterable* must be a sequence, an
|
||||
:term:`iterator`, or some other object which supports iteration. The
|
||||
:meth:`__next__` method of the iterator returned by :func:`enumerate` returns a
|
||||
tuple containing a count (from *start* which defaults to 0) and the
|
||||
|
@ -16,7 +16,7 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
enumobject *en;
|
||||
PyObject *seq = NULL;
|
||||
PyObject *start = NULL;
|
||||
static char *kwlist[] = {"sequence", "start", 0};
|
||||
static char *kwlist[] = {"iterable", "start", 0};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:enumerate", kwlist,
|
||||
&seq, &start))
|
||||
|
@ -369,9 +369,9 @@ filter_next(filterobject *lz)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(filter_doc,
|
||||
"filter(function or None, sequence) --> filter object\n\
|
||||
"filter(function or None, iterable) --> filter object\n\
|
||||
\n\
|
||||
Return an iterator yielding those items of sequence for which function(item)\n\
|
||||
Return an iterator yielding those items of iterable for which function(item)\n\
|
||||
is true. If function is None, return the items that are true.");
|
||||
|
||||
PyTypeObject PyFilter_Type = {
|
||||
@ -1174,7 +1174,7 @@ builtin_iter(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(iter_doc,
|
||||
"iter(collection) -> iterator\n\
|
||||
"iter(iterable) -> iterator\n\
|
||||
iter(callable, sentinel) -> iterator\n\
|
||||
\n\
|
||||
Get an iterator from an object. In the first form, the argument must\n\
|
||||
@ -1942,10 +1942,10 @@ builtin_sum(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(sum_doc,
|
||||
"sum(sequence[, start]) -> value\n\
|
||||
"sum(iterable[, start]) -> value\n\
|
||||
\n\
|
||||
Returns the sum of a sequence of numbers (NOT strings) plus the value\n\
|
||||
of parameter 'start' (which defaults to 0). When the sequence is\n\
|
||||
Returns the sum of an iterable of numbers (NOT strings) plus the value\n\
|
||||
of parameter 'start' (which defaults to 0). When the iterable is\n\
|
||||
empty, returns start.");
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user