Let fnmatch.filter accept a tuple of patterns


(Andrés Delfino) #1

Frequently, while globbing, one needs to work with multiple extensions. I’d like to propose for fnmatch.filter to handle a tuple of patterns instead of just one pattern, as a first step for glob.i?glob to accept multiple patterns as well.

Here is the implementation I came up with:

If this is deemed reasonable, I’ll write tests and documentation updates.


(Andrés Delfino) #2

“instead” can be misleading. I’m proposing for filter to accept either a str or a tuple, just like str.startswith does.