Skip to content

Commit 09ba833

Browse files
TonyFlurymiss-islington
authored andcommitted
[2.7] bpo-33006 - Correct filter doc string to clarify 2nd argument can be iterable (GH-6015)
https://bugs.python.org/issue33006
1 parent aaed2c3 commit 09ba833

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Clarified Doc string for builtin filter function. 2nd Argument can be any
2+
iterable. Patch by Tony Flury

Python/bltinmodule.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,12 @@ builtin_filter(PyObject *self, PyObject *args)
351351
}
352352

353353
PyDoc_STRVAR(filter_doc,
354-
"filter(function or None, sequence) -> list, tuple, or string\n"
355-
"\n"
356-
"Return those items of sequence for which function(item) is true. If\n"
357-
"function is None, return the items that are true. If sequence is a tuple\n"
358-
"or string, return the same type, else return a list.");
354+
"filter(function or None, iterable) -> list, string or tuple\n\
355+
\n\
356+
Return a sequence yielding those items of iterable for which function(item)\n\
357+
is true. If function is None, return the items that are true.\n\
358+
If iterable is a string or a tuple, the result also has that type; otherwise\n\
359+
it is always a list.");
359360

360361
static PyObject *
361362
builtin_format(PyObject *self, PyObject *args)

0 commit comments

Comments
 (0)