]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-33006 - Correct filter doc string to clarify 2nd argument can be iterable...
authorTony Flury <anthony.flury@btinternet.com>
Wed, 29 May 2019 01:36:04 +0000 (02:36 +0100)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 29 May 2019 01:36:04 +0000 (18:36 -0700)
https://bugs.python.org/issue33006

Misc/NEWS.d/next/Core and Builtins/2018-03-07-09-10-42.bpo-33006.Bzx3LA.rst [new file with mode: 0644]
Python/bltinmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-03-07-09-10-42.bpo-33006.Bzx3LA.rst b/Misc/NEWS.d/next/Core and Builtins/2018-03-07-09-10-42.bpo-33006.Bzx3LA.rst
new file mode 100644 (file)
index 0000000..0bcc0a4
--- /dev/null
@@ -0,0 +1,2 @@
+Clarified Doc string for builtin filter function. 2nd Argument can be any
+iterable. Patch by Tony Flury
index 4b819da8b39948846e35dadb7459de57a19f8610..6d47de1fb20e32313fb8a08acf6c02c60a12f25b 100644 (file)
@@ -351,11 +351,12 @@ Fail_arg:
 }
 
 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)