[Python-checkins] bpo-36769: Document that fnmatch.filter supports any kind of iterable (GH-13039)

miss-islington webhook-mailer at python.org
Fri Dec 18 14:34:37 EST 2020


https://github.com/python/cpython/commit/4b412e830d0a7d3f30af60b9eb285558511d90af
commit: 4b412e830d0a7d3f30af60b9eb285558511d90af
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-12-18T11:34:27-08:00
summary:

bpo-36769: Document that fnmatch.filter supports any kind of iterable (GH-13039)

(cherry picked from commit e8d22642105d57007ab1242848a8cbadc7f179df)

Co-authored-by: Andre Delfino <adelfino at gmail.com>

files:
M Doc/library/fnmatch.rst
M Lib/fnmatch.py

diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst
index ce07d326b395d..925f08e914685 100644
--- a/Doc/library/fnmatch.rst
+++ b/Doc/library/fnmatch.rst
@@ -75,7 +75,7 @@ patterns.
 
 .. function:: filter(names, pattern)
 
-   Return the subset of the list of *names* that match *pattern*. It is the same as
+   Construct a list from those elements of the iterable *names* that match *pattern*. It is the same as
    ``[n for n in names if fnmatch(n, pattern)]``, but implemented more efficiently.
 
 
diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py
index 0eb1802bdb53c..7c52c23067d40 100644
--- a/Lib/fnmatch.py
+++ b/Lib/fnmatch.py
@@ -52,7 +52,7 @@ def _compile_pattern(pat):
     return re.compile(res).match
 
 def filter(names, pat):
-    """Return the subset of the list NAMES that match PAT."""
+    """Construct a list from those elements of the iterable NAMES that match PAT."""
     result = []
     pat = os.path.normcase(pat)
     match = _compile_pattern(pat)



More information about the Python-checkins mailing list