Message201020
In Python 2.7, future_builtins.map accepts None as its first (function) argument:
Python 2.7.5 (default, Aug 1 2013, 01:01:17)
>>> from future_builtins import map
>>> list(map(None, range(3), 'ABC'))
[(0, 'A'), (1, 'B'), (2, 'C')]
But in Python 3.x, map does not accept None as its first argument:
Python 3.3.2 (default, May 21 2013, 11:50:47)
>>> list(map(None, range(3), 'ABC'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
The documentation says, "if you want to write code compatible with Python 3 builtins, import them from this module," so this incompatibility may give Python 2.7 programmers the false impression that a program which uses map(None, ...) is portable to Python 3.
I suggest that future_builtins.map in Python 2.7 should behave the same as map in Python 3: that is, it should raise a TypeError if None was passed as the first argument. |
|
Date |
User |
Action |
Args |
2013-10-23 13:16:29 | gdr@garethrees.org | set | recipients:
+ gdr@garethrees.org |
2013-10-23 13:16:29 | gdr@garethrees.org | set | messageid: <1382534189.14.0.63787411181.issue19363@psf.upfronthosting.co.za> |
2013-10-23 13:16:29 | gdr@garethrees.org | link | issue19363 messages |
2013-10-23 13:16:28 | gdr@garethrees.org | create | |
|