Skip to content

Commit d11ae5d

Browse files
committed
Rename enumerate() kw argument name to "iterable" and fix "sequence"->"iterable" in some docstrings.
1 parent 1f2ba4b commit d11ae5d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Doc/library/functions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ are always available. They are listed here in alphabetical order.
325325
< abs(b)``.
326326

327327

328-
.. function:: enumerate(sequence[, start=0])
328+
.. function:: enumerate(iterable[, start=0])
329329

330-
Return an enumerate object. *sequence* must be a sequence, an
330+
Return an enumerate object. *iterable* must be a sequence, an
331331
:term:`iterator`, or some other object which supports iteration. The
332332
:meth:`__next__` method of the iterator returned by :func:`enumerate` returns a
333333
tuple containing a count (from *start* which defaults to 0) and the

Objects/enumobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1616
enumobject *en;
1717
PyObject *seq = NULL;
1818
PyObject *start = NULL;
19-
static char *kwlist[] = {"sequence", "start", 0};
19+
static char *kwlist[] = {"iterable", "start", 0};
2020

2121
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:enumerate", kwlist,
2222
&seq, &start))

Python/bltinmodule.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ filter_next(filterobject *lz)
369369
}
370370

371371
PyDoc_STRVAR(filter_doc,
372-
"filter(function or None, sequence) --> filter object\n\
372+
"filter(function or None, iterable) --> filter object\n\
373373
\n\
374-
Return an iterator yielding those items of sequence for which function(item)\n\
374+
Return an iterator yielding those items of iterable for which function(item)\n\
375375
is true. If function is None, return the items that are true.");
376376

377377
PyTypeObject PyFilter_Type = {
@@ -1174,7 +1174,7 @@ builtin_iter(PyObject *self, PyObject *args)
11741174
}
11751175

11761176
PyDoc_STRVAR(iter_doc,
1177-
"iter(collection) -> iterator\n\
1177+
"iter(iterable) -> iterator\n\
11781178
iter(callable, sentinel) -> iterator\n\
11791179
\n\
11801180
Get an iterator from an object. In the first form, the argument must\n\
@@ -1942,10 +1942,10 @@ builtin_sum(PyObject *self, PyObject *args)
19421942
}
19431943

19441944
PyDoc_STRVAR(sum_doc,
1945-
"sum(sequence[, start]) -> value\n\
1945+
"sum(iterable[, start]) -> value\n\
19461946
\n\
1947-
Returns the sum of a sequence of numbers (NOT strings) plus the value\n\
1948-
of parameter 'start' (which defaults to 0). When the sequence is\n\
1947+
Returns the sum of an iterable of numbers (NOT strings) plus the value\n\
1948+
of parameter 'start' (which defaults to 0). When the iterable is\n\
19491949
empty, returns start.");
19501950

19511951

0 commit comments

Comments
 (0)