Mapping None. Why?
paddy3118 at googlemail.com
Fri Jun 13 06:57:29 CEST 2008
On Jun 12, 9:36 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> "Paddy" <paddy3... at googlemail.com> wrote in message
> news:a8874705-9f90-4acb-9930-b0afa03d4061 at 27g2000hsf.googlegroups.com...
> | 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
> zip. After that, map(None,...) was kept for back compatibility.
> In 3.0, the doc for map is
> "Return an iterator that applies function to every item of iterable,
> yielding the results. If additional iterable arguments are passed, function
> must take that many arguments and is applied to the items from all
> iterables in parallel. With multiple iterables, the iterator stops when the
> shortest iterable is exhausted."
> Using a map defined with None raises
> TypeError: 'NoneType' object is not callable
I really should get into the habit of reading the 3.0 docs before
asking questions :-)
My original question came about after answering this query:
More information about the Python-list