Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-74598: addfnmatch.filterfalse for excluding names#121185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fnmatch.filterfalse for excluding patternsfnmatch.filterfalse for excluding namesUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
picnixz commentedMar 1, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
FT failure is known so I'll wait until the fix (#130724) is merged. |
… feat/fnmatch/filterfalse-74598
…h/filterfalse-74598
I'm going to run some benchmarks again and then I'll merge this one. The feature can still be useful and maintenance is not that hard. If, however, benchmarks are not good, I'll write a recipe instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I did have other plans forfnmatch, for supporting complex filters with multiple positive and negative patterns, this is why I was not particularly interested in this feature. But I don't think that addingfilterfalse() is wrong. It will not conflict with future features, and they will not make it obsolete.
LGTM. But please add more tests forfilterfalse() similar to otherfilter() tests inFilterTestCase. The code is completely separate, so we need to test all this.
Will do! |
3eda146 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
In this implementation, I did not use a lambda function as it was proposed in the original patch nor did I use auxiliary functions.
EDIT 07/04/2025: I kept the use of
filterfalseas on a PGO build the loop variant was much slower when processing past a certain number of files. For < 10 files, the numbers are roughly the same and in the range of nanoseconds so we don't really care.Benchmark script
📚 Documentation preview 📚:https://cpython-previews--121185.org.readthedocs.build/