diff options
author | 2021-01-20 02:43:22 -0800 | |
---|---|---|
committer | 2021-01-20 02:43:22 -0800 | |
commit | 8f334dbbf04582071d1318e5817e2fe99f1e5169 (patch) | |
tree | 8cdd822a6ac63dc76529ffe4381ddad7fbe17866 | |
parent | bpo-42005: profile and cProfile catch BrokenPipeError (GH-22643) (diff) | |
download | cpython-8f334dbbf04582071d1318e5817e2fe99f1e5169.tar.gz cpython-8f334dbbf04582071d1318e5817e2fe99f1e5169.tar.bz2 cpython-8f334dbbf04582071d1318e5817e2fe99f1e5169.zip |
bpo-36769: Document that fnmatch.filter supports any kind of iterable (GH-13039)
(cherry picked from commit e8d22642105d57007ab1242848a8cbadc7f179df)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
-rw-r--r-- | Doc/library/fnmatch.rst | 2 | ||||
-rw-r--r-- | Lib/fnmatch.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst index ce07d326b39..925f08e9146 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 b98e6413295..7d52871a829 100644 --- a/Lib/fnmatch.py +++ b/Lib/fnmatch.py @@ -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) |