Mapping None. Why?

Ian Kelly ian.g.kelly at gmail.com
Fri Jun 13 16:13:32 EDT 2008


On Fri, Jun 13, 2008 at 2:00 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> filter(None, iterable) works the same way: None-> identity function,
> The immediate reason is the Python has no builtin id().
> But apparently there is also historical precedent in the functional
> community for this convention.

Another way of viewing it is that filter(None, iterable) applies no
function at all before testing the truth values, which does make some
sense.  With map, however, this is not strictly true.



More information about the Python-list mailing list