This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Update Python 2/3 porting HOWTO's suggestion for dealing with map()
Type: enhancement Stage: needs patch
Components: Documentation Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, josh.r
Priority: normal Keywords: easy

Created on 2014-04-15 15:45 by brett.cannon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg216315 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-04-15 15:45
In Python 2.6 and newer you can import future_builtins and use everything from there. In Python 2.5 it should be itertools.imap(). This is much cleaner than the current suggestion at https://docs.python.org/2/howto/pyporting.html#update-map-for-imbalanced-input-sequences
msg216458 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2014-04-16 11:17
I think the suggestion is intended for "how do I keep Python 2 semantics in Python 3?", not "how can I write my Python 2 code so it will run equivalently in Python 3?"

It wouldn't be a bad idea to point out that you can adopt Py3 semantics initially so as to avoid surprises later on; sadly, unlike a __future__ import, if you want cross compatible code you have to do stupid stuff like:

try:
    from future_builtins import *
except ImportError:
    # Py3 is already the future
    pass
msg218191 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-05-09 18:35
I never bothered to mention the iter* methods in the HOWTO, and since it becomes very obvious very fast to tweak them I'm not going to worry about it and add more complexity to the doc.
History
Date User Action Args
2022-04-11 14:58:01adminsetgithub: 65436
2014-05-09 18:35:11brett.cannonsetstatus: open -> closed
resolution: wont fix
messages: + msg218191
2014-04-16 11:17:04josh.rsetnosy: + josh.r
messages: + msg216458
2014-04-15 15:45:50brett.cannoncreate