This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bool makes filter(None,it) redundant; remove None option?
Type: behavior Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, gvanrossum, rhettinger, terry.reedy
Priority: normal Keywords:

Created on 2008-05-04 17:42 by terry.reedy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg66219 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2008-05-04 17:42
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.
msg66226 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-04 18:08
FYI, filter() already special-cases "bool". I think the discussion
whether to remove the None argument has been had, but I could be
mistaken. Guido, do you remember more?
msg66236 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-05-04 19:48
It was deferred to me and I decided to keep the None argument as this 
is the standard way of spelling a missing argument.  Also, the None 
argument provides a pretty good clue that a special fast path is being 
taken.
msg66241 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-04 21:22
Okay, closing as won't fix.
msg66248 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2008-05-04 22:16
Reopening for the alternate suggested fix of adding a note to 3099,
which I checked before submitting this, so this need not come up again.
msg66286 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-05 21:00
I don't think this is important enough to get into 3099.
History
Date User Action Args
2022-04-11 14:56:34adminsetgithub: 47008
2008-05-05 21:00:27georg.brandlsetstatus: open -> closed
messages: + msg66286
2008-05-04 22:16:53terry.reedysetstatus: closed -> open
assignee: georg.brandl
messages: + msg66248
resolution: wont fix ->
components: + Documentation, - Interpreter Core
2008-05-04 21:22:17georg.brandlsetstatus: open -> closed
assignee: gvanrossum -> (no value)
resolution: wont fix
messages: + msg66241
2008-05-04 19:48:55rhettingersetnosy: + rhettinger
messages: + msg66236
2008-05-04 18:08:12georg.brandlsetassignee: gvanrossum
messages: + msg66226
nosy: + gvanrossum, georg.brandl
2008-05-04 17:42:06terry.reedycreate