]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36769: Document that fnmatch.filter supports any kind of iterable (#13039)
authorAndre Delfino <adelfino@gmail.com>
Fri, 18 Dec 2020 19:10:20 +0000 (16:10 -0300)
committerGitHub <noreply@github.com>
Fri, 18 Dec 2020 19:10:20 +0000 (20:10 +0100)
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 0eb1802bdb53c5d8594e06a08cfe4d0e5f8f6a94..7c52c23067d40f3e808b160647ff3537823325ec 100644 (file)
@@ -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)