From d11ae5d6ecda1d233af651a360c9f9140992f05d Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 16 May 2008 13:27:32 +0000 Subject: [PATCH] Rename enumerate() kw argument name to "iterable" and fix "sequence"->"iterable" in some docstrings. --- Doc/library/functions.rst | 4 ++-- Objects/enumobject.c | 2 +- Python/bltinmodule.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index def6ae64c09..875eea00830 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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 diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 08c7c096cad..5c60d8ca2e9 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -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)) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index de3f0f4846a..23e87b38411 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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.");