Andre Delfino writes:

 > Frequently, while globbing, one needs to work with multiple extensions. I’d
 > like to propose for fnmatch.filter to handle a tuple of patterns (while
 > preserving the single str argument functionality, alas str.endswith),

This is one of those famous 3-line functions, though:

    import fnmatch
    def multifilter(names, *patterns):
        result = []
        for p in patterns:
            result.extend(fnmatch.filter(names, p)
        return result

It's a 3-line function in 5 lines, OK, but still.

 > as a first step for glob.i?glob to accept multiple patterns as well.

If you're going to improve the glob module, why not use bash or zsh
extended globbing ('**', '{a,b}') as the model?  This is more
powerful, and already familiar to many users.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to