bpo-36769: Document that fnmatch.filter supports any kind of iterable… · python/cpython@e8d2264 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit e8d2264

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

File tree

2 files changed

lines changed

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ patterns.
75 75
76 76 .. function:: filter(names, pattern)
77 77
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
79 79 ``[n for n in names if fnmatch(n, pattern)]``, but implemented more efficiently.
80 80
81 81
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ def _compile_pattern(pat):
52 52 return re.compile(res).match
53 53
54 54 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."""
56 56 result = []
57 57 pat = os.path.normcase(pat)
58 58 match = _compile_pattern(pat)