[New-bugs-announce] [issue2759] Bool makes filter(None,it) redundant; remove None option?

Terry J. Reedy report at bugs.python.org
Sun May 4 19:42:07 CEST 2008


New submission from Terry J. Reedy <tjreedy at udel.edu>:

Filter() allows None as a stand-in for either the still-nonexistent
identity() or the now existent bool().  Removing the now redundant
option would slightly simplify the language.  It is certainly a glitch
for newcomers.  Would this option be included if filter were being added
now?

Fixer: I should think filter(None,it) => filter(bool,it) should be
sufficient as I expect filter(f_f_exp, it), where f_f_exp is a filter
function expression that sometimes gives None, should be fairly rare.

Efficiency: filter() could (if it does not now) avoid calling bool twice
internally by checking for bool instead of None).  Even if removing None
is rejected, filter should also check for bool (if it does not now) to
not penalize those who write the obvious filter(bool,it).

If this item is rejected, turn it into a doc item for PEP3099.

----------
components: Interpreter Core
messages: 66219
nosy: tjreedy
severity: normal
status: open
title: Bool makes filter(None,it) redundant; remove None option?
type: behavior
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2759>
__________________________________


More information about the New-bugs-announce mailing list