Title: Update porting HOWTO to special-case Python 2 code, not Python 3
Type: Stage: resolved
Components: Documentation Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, docs@python, ncoghlan, python-dev
Priority: normal Keywords:

Created on 2016-01-13 02:16 by brett.cannon, last changed 2016-03-18 20:24 by brett.cannon. This issue is now closed.

Messages (4)
msg258126 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-01-13 02:16
As pointed out by, special-casing Python 3 code instead of Python 2 code when writing Python 2/3 code will lead to breakage when Python 3 comes out. There should probably be a note in the porting HOWTO mentioning that you should always special-case Python 2 code and not Python 3 code.
msg258127 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-01-13 02:17
And suggesting feature detection is even better than version detection.
msg258130 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2016-01-13 04:33
The feature detection approach is especially important for anything covered by the security backports in PEP 466 and 476, but can also apply for things like installing the importlib2 meta_path hooks into Python 2.7.
msg261992 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-18 20:24
New changeset a2bf6d1e018e by Brett Cannon in branch 'default':
Merge for issue #26095
Date User Action Args
2016-03-18 20:24:39brett.cannonsetstatus: open -> closed
resolution: fixed
stage: resolved
2016-03-18 20:24:25python-devsetnosy: + python-dev
messages: + msg261992
2016-01-22 23:30:38brett.cannonsetassignee: docs@python -> brett.cannon
2016-01-13 04:33:36ncoghlansetnosy: + ncoghlan
messages: + msg258130
2016-01-13 02:17:07brett.cannonsetmessages: + msg258127
2016-01-13 02:16:37brett.cannoncreate