[issue6210] Exception Chaining missing method for suppressing context
Matthew Barnett
report at bugs.python.org
Tue Dec 28 04:31:28 CET 2010
Matthew Barnett <python at mrabarnett.plus.com> added the comment:
Regarding syntax, I'm undecided between:
raise with new_exception
and:
raise new_exception with caught_exception
I think that the second form is clearer:
try:
...
exception SomeException as ex:
raise SomeOtherException() with ex
(I'd prefer 'with' to Steven's 'from') but the first form doesn't force you to provide a name:
try:
...
exception SomeException:
raise with SomeOtherException()
and the syntax also means that you can't chain another exception like this:
try:
...
exception SomeException as ex:
raise SomeOtherException() with YetAnotherException()
although perhaps Python should just rely on the programmer's good judgement. :-)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6210>
_______________________________________
More information about the Python-bugs-list
mailing list