You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In examples, "except:" should use new syntax #60545
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2012-10-30.19:57:23.005>created_at=<Date2012-10-28.01:58:40.528>labels= ['easy', 'type-feature', 'docs']
title='In examples, "except:" should use new syntax'updated_at=<Date2012-10-30.19:57:23.004>user='https://github.com/jcea'
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 bpo-16332.
The only thing is that this syntax, used in examples, would be incompatible with old python releases.
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?
Activity
jcea commentedon Oct 28, 2012
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 bpo-16332.
The only thing is that this syntax, used in examples, would be incompatible with old python releases.
Opinions?
asvetlov commentedon Oct 28, 2012
+1.
Patch for 2.7 is attached.
merwok commentedon Oct 28, 2012
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?
ezio-melotti commentedon Oct 28, 2012
The patch LGTM, and there are only 21 changes.
python-dev commentedon Oct 30, 2012
New changeset 4e9617d3c514 by Andrew Svetlov in branch '2.7':
Issue bpo-16341: convert examples to use except ... as ... syntax.
http://hg.python.org/cpython/rev/4e9617d3c514