On 24/03/2021 23:35, adelf...@gmail.com wrote:
Several attempts in this thread to write "simpler" code that does this job 
proved to be buggy. I feel there's some ground to say that having this in the library 
could prevent other less talented writers make those or even bigger mistakes.

I feel a tuple to specify multiple patterns fits nicely and it's easier to 
explain that an extended syntax.

I have created an issue and opened a PR with doc and tests, if this is deemed 
something worth to have.

Here's a sketch for yet another implementation:

Change _compile_pattern() and maybe translate() to return a regex that matches multiple patterns. Then you could leave the already over-complicated implementation of filter() alone and would support tuples or iterators of patterns in fnmatch() and fnmatchcase(), too.

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ZZQFWUPMDK7IO6ANSURKQ5MKV27IRW6Z/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to