Mapping None. Why?
Terry Reedy
tjreedy at udel.edu
Thu Jun 12 16:36:07 EDT 2008
"Paddy" <paddy3118 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
tjr
More information about the Python-list
mailing list