Issue 26095: Update porting HOWTO to special-case Python 2 code, not Python 3 (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/70283

classification

Title: Update porting HOWTO to special-case Python 2 code, not Python 3
Type: Stage: resolved
Components: Documentation Versions:

process

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 2022-04-11 14:58 by admin. 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 http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/, 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: Alyssa 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 https://hg.python.org/cpython/rev/a2bf6d1e018e
History
Date User Action Args
2022-04-11 14:58:26 admin set github: 70283
2016-03-18 20:24:39 brett.cannon set status: open -> closedresolution: fixedstage: resolved
2016-03-18 20:24:25 python-dev set nosy: + python-devmessages: +
2016-01-22 23:30:38 brett.cannon set assignee: docs@python -> brett.cannon
2016-01-13 04:33:36 ncoghlan set nosy: + ncoghlanmessages: +
2016-01-13 02:17:07 brett.cannon set messages: +
2016-01-13 02:16:37 brett.cannon create