[Tutor] map, filter and lambda functions [filter can take None]

Tim Peters tim.one@home.com
Sat, 25 Aug 2001 23:31:08 -0400


[Danny Yoo]
> ...
> Feeding 'None' as a "function" is a special case that's particular
> only to Python's implementation of filter(), that is, this is
> hardcoded to recognize this unusual input.  It certainly doesn't do it
> for a human-intuitive reason.  *grin*

[Allan Crooks]
> And yet again, a question that could only be solved by looking at
> the C code is answered by Danny. Only he would wade through the
> source, make it understandable and explain it for us, so I'll take
> this opportunity to thank him for it. :)

At some point after thanking him, you might try reading the docs too <wink>.
The special behavior of None when fed to filter() has been documented for
years:

    http://www.python.org/doc/current/lib/built-in-funcs.html

In fact, a great way to learn a lot about Python is to play with the docs
for the builtin functions, trying them one at a time.