Matthew Barnett <pyt...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue6210>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to