Ethan Furman <et...@stoneleaf.us> added the comment:

Nick Coghlan wrote:
> The from clause is intended for replacing previous exceptions with *new*
> exceptions, not editing the attributes of existing ones which may already
> have a different __cause__ set.

Huh.  While I agree with the doc patch solution, I think the most common 
use of 'from' will be 'raise SomeException from None' or, as the patch 
suggests, 'raise exc from None' (exc being an already existing exception).

Any examples of when somebody might do:

try:
    do_something()
except NameError:
    raise NewError from SomeOtherError

?

I am unsure of the advantages in replacing NameError in the above stack 
trace with SomeOtherError instead... although NameError would still be 
there in __context__...

Still, any examples?

~Ethan~

----------

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

Reply via email to