New submission from Antoine Amarilli:

Hello,

Python 2.7.8 and Python 3.4.2 (from Debian testing) have a different behavior 
on the attached file. Python 2 raises "bar", Python 3 raises "foo".

I can't find an adequate explanation in the documentation for this behavior 
difference. It probably relates to 
https://docs.python.org/3/reference/compound_stmts.html#try (search for "When 
an exception has been assigned") but this is unsatisfying because it only talks 
about the "as target" construction, which is not used in the example.

I think that at least the documentation should be clarified to point out what 
"raise" without arguments will do. Currently the documentation of this in 
Python 2 and 3 is the same even though the behavior is different 
https://docs.python.org/2/reference/simple_stmts.html#raise 
https://docs.python.org/3/reference/simple_stmts.html#raise.

Note: this question was originally asked on SO: 
http://stackoverflow.com/q/28698622/414272. I reported this as a bug at Terry 
Jan Reedy's request 
https://stackoverflow.com/q/28698622/414272#comment45707744_28698622.

----------
files: raise.py
messages: 236957
nosy: a3nm
priority: normal
severity: normal
status: open
title: Scope for raise without argument is different in Python 2 and 3
type: behavior
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file38285/raise.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to