Mapping None. Why?

Ian Kelly ian.g.kelly at gmail.com
Thu Jun 12 21:45:00 CEST 2008


On Thu, Jun 12, 2008 at 1:32 PM, Diez B. Roggisch <deets at nospam.web.de> wrote:
> Because it is undefined what should happen in case of no function given at
> all - and because there is no identity function in python pre-defined, it
> could be considered sensible to make None the quivalent of that function.

It makes more sense to raise an error when a non-function is passed
where a function is expected.  If we're going to have a special
behaviour for None, why not have special behaviours for True, False,
and 42 as well?  The proper solution to the lack of a built-in packing
(not identity) function is to define a packing function, not to
special-case an arbitrary value to *mean* the packing function in
certain situations.

Ian



More information about the Python-list mailing list