(names, pat)
return result
Construct a list from those elements of the iterable NAMES that match PAT.
Construct a list from those elements of the iterable NAMES that match PAT.
Construct a list from those elements of the iterable NAMES that match PAT .
def filter(names, pat):
    """Construct a list from those elements of the iterable NAMES that match PAT."""
    result = []
    pat = os.path.normcase(pat)
    match = _compile_pattern(pat)
    if os.path is posixpath:
        # normcase on posix is NOP. Optimize it away from the loop.
        for name in names:
            if match(name):
                result.append(name)
    else:
        for name in names:
            if match(os.path.normcase(name)):
                result.append(name)
    return result
def filter ( names , pat ) : result = [ ] pat = os . path . normcase ( pat ) match = _compile_pattern ( pat ) if os . path is posixpath : # normcase on posix is NOP. Optimize it away from the loop. for name in names : if match ( name ) : result . append ( name ) else : for name in names : if match ( os . path . normcase ( name ) ) : result . append ( name ) return result