Re: Mapping None. Why?

2008-06-13 Thread David C. Ullrich
On Thu, 12 Jun 2008 12:05:02 -0700 (PDT), Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None: If you start with a value x and then apply no function at all to it, what results is x. Help on built-in function map in module

Re: Mapping None. Why?

2008-06-13 Thread Paddy
On Jun 13, 12:49 pm, David C. Ullrich [EMAIL PROTECTED] wrote: On Thu, 12 Jun 2008 12:05:02 -0700 (PDT), Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None: If you start with a value x and then apply no function at all to it,

Re: Mapping None. Why?

2008-06-13 Thread David C. Ullrich
In article [EMAIL PROTECTED], Paddy [EMAIL PROTECTED] wrote: On Jun 13, 12:49 pm, David C. Ullrich [EMAIL PROTECTED] wrote: On Thu, 12 Jun 2008 12:05:02 -0700 (PDT), Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None:

Re: Mapping None. Why?

2008-06-13 Thread Terry Reedy
David C. Ullrich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | In article | [EMAIL PROTECTED], | Paddy [EMAIL PROTECTED] wrote: | | True, but None is not a function. It's a sentinel value to turn on the | functionality. | | Uh, thanks. I think I knew that - I was just suggesting

Re: Mapping None. Why?

2008-06-13 Thread Ian Kelly
On Fri, Jun 13, 2008 at 2:00 PM, Terry Reedy [EMAIL PROTECTED] 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.

Mapping None. Why?

2008-06-12 Thread Paddy
Iam wondering why the peculiar behavior of map when the function in given as None: Help on built-in function map in module __builtin__: map(...) map(function, sequence[, sequence, ...]) - list Return a list of the results of applying the function to the items of the argument

Re: Mapping None. Why?

2008-06-12 Thread Diez B. Roggisch
Paddy schrieb: Iam wondering why the peculiar behavior of map when the function in given as None: Help on built-in function map in module __builtin__: map(...) map(function, sequence[, sequence, ...]) - list Return a list of the results of applying the function to the items of the

Re: Mapping None. Why?

2008-06-12 Thread Ian Kelly
On Thu, Jun 12, 2008 at 1:05 PM, Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None: Because that's the way it's always been! Seriously, I don't know. I can tell you that it's going away in Python 3.0, though. Ian --

Re: Mapping None. Why?

2008-06-12 Thread Ian Kelly
On Thu, Jun 12, 2008 at 1:32 PM, Diez B. Roggisch [EMAIL PROTECTED] 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

Re: Mapping None. Why?

2008-06-12 Thread Robert Kern
Ian Kelly wrote: On Thu, Jun 12, 2008 at 1:05 PM, Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None: Because that's the way it's always been! Seriously, I don't know. I can tell you that it's going away in Python 3.0, though.

Re: Mapping None. Why?

2008-06-12 Thread Diez B. Roggisch
Ian Kelly schrieb: On Thu, Jun 12, 2008 at 1:32 PM, Diez B. Roggisch [EMAIL PROTECTED] 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

Re: Mapping None. Why?

2008-06-12 Thread Terry Reedy
Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | | Iam wondering why the peculiar behavior of map when the function in | given as None: The 'peculiar behavior' is the same as zip (except for padding short iterators versus truncating long iterators. Map was added years before

Re: Mapping None. Why?

2008-06-12 Thread Robert Kern
Paddy wrote: On looking up map on Wikipedia there is no mention of this special behaviour, So my question is why? My question is why you are looking up the semantics of Python functions on Wikipedia instead of the Python documentation. I don't see any particular discussion of map() there at

Re: Mapping None. Why?

2008-06-12 Thread Paddy
On Jun 12, 8:55 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: 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 Oh no! Sorry to give

Re: Mapping None. Why?

2008-06-12 Thread Paddy
On Jun 12, 9:48 pm, Robert Kern [EMAIL PROTECTED] wrote: Paddy wrote: On looking up map on Wikipedia there is no mention of this special behaviour, So my question is why? My question is why you are looking up the semantics of Python functions on Wikipedia instead of the Python

Re: Mapping None. Why?

2008-06-12 Thread Paddy
On Jun 12, 9:36 pm, Terry Reedy [EMAIL PROTECTED] wrote: Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | | Iam wondering why the peculiar behavior of map when the function in | given as None: The 'peculiar behavior' is the same as zip (except for padding short iterators