Skip to content

Commit 4b412e8

Browse files
bpo-36769: Document that fnmatch.filter supports any kind of iterable (GH-13039)
(cherry picked from commit e8d2264) Co-authored-by: Andre Delfino <[email protected]>
1 parent 82dbfd5 commit 4b412e8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Doc/library/fnmatch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ patterns.
7575

7676
.. function:: filter(names, pattern)
7777

78-
Return the subset of the list of *names* that match *pattern*. It is the same as
78+
Construct a list from those elements of the iterable *names* that match *pattern*. It is the same as
7979
``[n for n in names if fnmatch(n, pattern)]``, but implemented more efficiently.
8080

8181

Lib/fnmatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _compile_pattern(pat):
5252
return re.compile(res).match
5353

5454
def filter(names, pat):
55-
"""Return the subset of the list NAMES that match PAT."""
55+
"""Construct a list from those elements of the iterable NAMES that match PAT."""
5656
result = []
5757
pat = os.path.normcase(pat)
5858
match = _compile_pattern(pat)

0 commit comments

Comments
 (0)