[New-bugs-announce] [issue37101] Filterer.filter can be rewritten using built-ins just as efficient much more readable

Dale Visser report at bugs.python.org
Thu May 30 11:49:09 EDT 2019


New submission from Dale Visser <dale.visser at live.com>:

Alternative version of Filterer.filter(...) would look like this, which takes advantage of efficient Python 3.x built-ins, and is immediately understandable:

def _filter_callable(filter):
    return filter.filter if hasattr(filter, 'filter') else filter

def filter(self, record):
    filters = map(_filter_callable, self.filters)
    return all(f(record) for f in filters)

I will add a tested pull request on GitHub.

----------
components: Library (Lib)
messages: 343983
nosy: dwvisser
priority: normal
severity: normal
status: open
title: Filterer.filter can be rewritten using built-ins just as efficient much more readable
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37101>
_______________________________________


More information about the New-bugs-announce mailing list