Re: Mapping None. Why?



Ian Kelly schrieb:
On Thu, Jun 12, 2008 at 1:32 PM, Diez B. Roggisch <deets@xxxxxxxxxxxxx> 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.

You are right with the packing-function, it's not identity of course.

However I don't see that this as an area that is really important (especially since map is being replaced by list-comps most of the time).

And the OP's question was about map not being conforming to the definition on wikipedia - which I don't think it's not. It is not defined what map is to do with None (or NULL or nil or... ) as argument.

Diez
.



Relevant Pages

  • Re: Mapping None. Why?
    ... all - and because there is no identity function in python pre-defined, ... behaviour for None, why not have special behaviours for True, False, ... function is to define a packing function, ... special-case an arbitrary value to *mean* the packing function in ...
    (comp.lang.python)
  • Re: Single function to copy list into array & vice versa?
    ... The identity function is defined in the manual, but is an "unbound function" when I try to run it. ... It isn't "vital" that I have an identity function, I can simply use the map ... I'm using XLISP because I do a lot of programming in Nyquist, an offshoot of XLISP which works with sound - I test some of my non-sound functions first in XLISP ... On Sun, 23 Apr 2006, Frank Buss wrote: ...
    (comp.lang.lisp)
  • Re: Complex Weirdness
    ... the identity function is such a map. ... or even arbitrary continuous maps. ... >Unsolicited bulk E-mail subject to legal action. ...
    (sci.math)