[Python-ideas] fnmatch.filter_false

Pavol Lisy pavol.lisy at gmail.com
Sun May 21 02:04:04 EDT 2017

On 5/20/17, Steven D'Aprano <steve at pearwood.info> wrote:
> On Wed, May 17, 2017 at 12:14:05PM -0400, Alex Walters wrote:
>> Fnmath.filter works great.  To remind people what it does, it takes an
>> iterable of strings and a pattern and returns a list of the strings that
>> match the pattern.  And that is wonderful
>> However, I often need to filter *out* the items that match the pattern
>> (to
>> ignore them).  In every project that I need this I end up copying the
>> function out of the fnmatch library and adding 'not' to the test clause.
>> It
>> would be wonderful if there was a filter_false version in the standard
>> library.  Or in inversion Boolean option.  Or something, to stop from
>> having
>> to copy code every time I need to ignore files.
> Since I haven't seen any substantial objections to this idea, I've
> created an issue on the bug tracker, including a patch.
> http://bugs.python.org/issue30413
> Unfortunately I have no CPU cycles available to learn the new Github way
> of doing things right now, somebody else will need to shepherd this
> through the rest of the process (making a PR, doing a review, rejecting
> or approving it, etc.)
> --
> Steve
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

If fnmatch.filter was written to solve performance, isn't calling
_filtered step back?


More information about the Python-ideas mailing list