Skip to content

[2.7] bpo-33006 - Correct filter doc string to clarify 2nd argument can be iterable #6015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Clarified Doc string for builtin filter function. 2nd Argument can be any
iterable. Patch by Tony Flury
11 changes: 6 additions & 5 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,12 @@ builtin_filter(PyObject *self, PyObject *args)
}

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

static PyObject *
builtin_format(PyObject *self, PyObject *args)
Expand Down