[New-bugs-announce] [issue25840] Allow `False` to be passed to `filter`

leewz report at bugs.python.org
Fri Dec 11 10:02:00 EST 2015


New submission from leewz:

Meaning:

    filter(False, lst)
    == (x for x in lst if not x)
    == itertools.filterfalse(None, lst)

I understand that it is a very minor enhancement, and with not much benefit. I just happened to think about it, and wondered why it didn't already exist. I figured it wouldn't hurt to put the idea out here.

(If anyone is interested, I was looking into ways that filter/map/itertools could "unwrap" each other at the C level to improve composition of generators, inspired by the functools.partial optimization.)

----------
messages: 256218
nosy: leewz
priority: normal
severity: normal
status: open
title: Allow `False` to be passed to `filter`
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25840>
_______________________________________


More information about the New-bugs-announce mailing list