]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36769: Document that fnmatch.filter supports any kind of iterable (GH-13039)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 20 Jan 2021 10:43:22 +0000 (02:43 -0800)
committerGitHub <noreply@github.com>
Wed, 20 Jan 2021 10:43:22 +0000 (02:43 -0800)
(cherry picked from commit e8d22642105d57007ab1242848a8cbadc7f179df)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
Doc/library/fnmatch.rst
Lib/fnmatch.py

index ce07d326b395d80605e4b712343a6b79feb5a37e..925f08e914685e89c5c176a53ad39fc368d4d7db 100644 (file)
@@ -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.
 
 
index b98e6413295e1ca278e164461cf151839d45a242..7d52871a829a341b6473e78d75f998a24a4624a0 100644 (file)
@@ -46,7 +46,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)