[issue12666] map semantic change not documented in What's New
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 3b505df38fd8 by Jason R. Coombs in branch '3.2': Issue #12666: Clarifying changes in map for Python 3 http://hg.python.org/cpython/rev/3b505df38fd8 New changeset 0e2812b16f5f by Jason R. Coombs in branch '3.2': Issue #12666: Added section about map changes. http://hg.python.org/cpython/rev/0e2812b16f5f New changeset 51af35bd46f7 by Jason R. Coombs in branch 'default': Merge fix for Issue #12666 from 3.2 http://hg.python.org/cpython/rev/51af35bd46f7 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Changes by Jason R. Coombs jar...@jaraco.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Éric Araujo mer...@netwok.org added the comment: The content of the patch is very helpful, but I question its location: I’m not sure people will find this nugget in the 3.2+ version of the What’s New in Python 3.0 document (sorry for not bringing that up sooner). Maybe you could update Doc/library/functions.rst instead, and/or Doc/howto/pyporting.rst? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Éric Araujo mer...@netwok.org added the comment: I have reported the bugs to the metatracker. In the meantime, could you manually upload a diff? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Jason R. Coombs jar...@jaraco.com added the comment: I'm attaching the diff at https://bitbucket.org/jaraco/cpython-issue12666/changeset/bc362109eed8 -- keywords: +patch Added file: http://bugs.python.org/file22848/cpython-issue12666-bc362109eed8.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Éric Araujo mer...@netwok.org added the comment: (HTTPS repos are not supported) -- hgrepos: +51 nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Éric Araujo mer...@netwok.org added the comment: Can you provide a public URI? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Changes by Jason R. Coombs jar...@jaraco.com: -- keywords: +patch Added file: http://bugs.python.org/file22839/bc362109eed8.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Jason R. Coombs jar...@jaraco.com added the comment: I don't know how that repo got to be private; I created it just like every other public repo I have, and I thought I was only allowed one private repo (this was my second). In any case, I updated the setting, and now it appears to be accessible via the bug tracker. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Jason R. Coombs jar...@jaraco.com added the comment: I'm not sure how the bugtracker patch mechanism works, but the patch it produced included a lot of changes that I didn't make (changesets already committed to the master repo). -- keywords: -patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: docs@python - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Jason R. Coombs jar...@jaraco.com added the comment: I've created a patch to address (1) and (2). Is there any value in also including this in the 2to3 fixer? I can see that it's a simple translation, but adds complexity to the converted code. I'd be content to go with just a documentation patch. I'll defer to Benjamin or his delegate on whether or not to update 2to3. -- hgrepos: +50 nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
New submission from Jason R. Coombs jar...@jaraco.com: In `whatsnew/3.0.html`, there is little said about the map builtin: map() and filter() return iterators. If you really need a list, a quick fix is e.g. list(map(...)), but a better fix is often to use a list comprehension (especially when the original code uses lambda), or rewriting the code so it doesn’t need a list at all. Particularly tricky is map() invoked for the side effects of the function; the correct transformation is to use a regular for loop (since creating a list would just be wasteful). This suggests that all one must do to port to Python 3 is wrap map in list, and in fact this is what the 2to3 fixers do, when in fact, map is semantically different in how it handles arguments of different lengths. Consider the following. def to_tuple(*args): return args print(list(map(to_tuple, [1,2,3], [4,5,6,7]))) On Python 2, this code outputs: [(1, 4), (2, 5), (3, 6), (None, 7)] On Python 3, this code outputs: [(1, 4), (2, 5), (3, 6)] I suggest three fixes (in order of importance): 1) Document the difference in whatsnew/3.0.html. 2) Describe how one should port code of this usage to 3.0. 3) Incorporate the porting in the 2to3 fixer (if possible). If no one objects, I'll begin on (1). Does anyone have any suggestions for a clean approach to (2)? -- assignee: docs@python components: 2to3 (2.x to 3.0 conversion tool), Documentation keywords: easy messages: 141470 nosy: docs@python, jason.coombs priority: normal severity: normal status: open title: map semantic change not documented in What's New type: behavior versions: Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12666] map semantic change not documented in What's New
Jason R. Coombs jar...@jaraco.com added the comment: I believe the correct solution to (2) is to use itertools.zip_longest. So to port to Python 3, the example would use: print(list(map(to_tuple, itertools.zip_longest([1,2,3], [4,5,6,7] -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12666 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com