Title: In examples, "except:" should use new syntax
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, cvrebert, docs@python, eric.araujo, ezio.melotti, jcea, python-dev, rhettinger
Priority: normal Keywords: easy, patch

Created on 2012-10-28 01:58 by jcea, last changed 2012-10-30 19:57 by asvetlov. This issue is now closed.

File name Uploaded Description Edit
issue16341.diff asvetlov, 2012-10-28 11:39
Messages (5)
msg173988 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-10-28 01:58
In python 2.7 documentation, doing "grep -i 'except.*,.*:' *rst" shows quite a few "old style" "except:". I think that "except X, e:" should be transformed to "except X as e:", for clarity, as done in issue #16332.

The only thing is that this syntax, used in examples, would be incompatible with old python releases.

msg174029 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-28 11:39
Patch for 2.7 is attached.
msg174075 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-10-28 20:28
I’m of two minds about this.  On one hand this syntax avoids silent bugs and is compatible with 3.x, on the other hand if people use the 2.7 docs and use Python 2.4 or 2.5 the examples won’t work.  Raymond, what’s your opinion?
msg174078 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-10-28 20:44
The patch LGTM, and there are only 21 changes.
msg174221 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-30 19:56
New changeset 4e9617d3c514 by Andrew Svetlov in branch '2.7':
Issue #16341: convert examples to use except ... as ... syntax.
Date User Action Args
2012-10-30 19:57:23asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-10-30 19:56:56python-devsetnosy: + python-dev
messages: + msg174221
2012-10-28 20:44:35ezio.melottisettype: enhancement

messages: + msg174078
nosy: + ezio.melotti
2012-10-28 20:28:19eric.araujosetnosy: + rhettinger, eric.araujo
messages: + msg174075
2012-10-28 11:45:31asvetlovsetstage: patch review
2012-10-28 11:39:35asvetlovsetfiles: + issue16341.diff

nosy: + asvetlov
messages: + msg174029

keywords: + patch
2012-10-28 05:17:04cvrebertsetnosy: + cvrebert
2012-10-28 02:35:51jceasetassignee: docs@python
components: + Documentation, - Library (Lib)
2012-10-28 01:59:46jceasetnosy: + docs@python
components: + Library (Lib)
2012-10-28 01:58:40jceacreate