[Python-ideas] suggestion for try/except program flow

Mark Donald foobarmus at gmail.com
Sat Mar 28 11:06:13 CET 2009


In this situation, which happens to me fairly frequently...

try:
 try:
     raise Cheese
 except Cheese, e:
     # handle cheese
     raise
except:
 # handle all manner of stuff, including cheese

...it would be nice (& more readable) if one were able to recatch a
named exception with the generic (catch-all) except clause of its own
try, something like this:

try:
 raise Cheese
except Cheese, e:
 # handle cheese
 recatch
except:
 # handle all manner of stuff, including cheese



More information about the Python-ideas mailing list