classification
Title: Would be nice to have a future import that turned off old except style
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Zaheer.Merali, benjamin.peterson, ezio.melotti
Priority: normal Keywords:

Created on 2012-01-11 13:24 by Zaheer.Merali, last changed 2012-01-11 14:05 by benjamin.peterson. This issue is now closed.

Messages (3)
msg151058 - (view) Author: Zaheer Merali (Zaheer.Merali) Date: 2012-01-11 13:24
It would be nice to have a future import to be able to prevent people in code doing:

try:
    ....
except Exception, e:
    ....

and make people do:

try:
    ....
except Exception as e:
    ....
msg151059 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-01-11 14:00
If you run python with the -3 flag you should get a warning about that.  If you combine it with -We you should be able to get an error instead of a warning.  Note however that both the flags are not specific for the "except" but also generate/affect other warnings as well.
msg151060 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-01-11 14:05
Unfortunately, that would be a new feature, so it is not acceptable to Python 2.7.
History
Date User Action Args
2012-01-11 14:05:38benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg151060

resolution: rejected
2012-01-11 14:00:30ezio.melottisetnosy: + ezio.melotti
messages: + msg151059
2012-01-11 13:24:51Zaheer.Meralicreate