[Python-ideas] raising an exception type doesn't instantiate it until it gets caught
Gregory P. Smith
greg at krypto.org
Mon Nov 7 02:38:00 CET 2011
On Tue, Nov 1, 2011 at 1:15 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> No, the traceback info is added by the eval loop itself. Remember that
> when you raise an exception *type* (rather than an instance), the
> exception doesn't get instantiated until it gets caught somewhere -
> the eval loop maintains the unwinding stack for the traceback as part
> of the thread state until it is time to attach it to the exception
> object.
>
I did not know that. Is there a good reason for doing this? It seems
unnecessarily complicated.
-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111106/95726310/attachment.html>
More information about the Python-ideas
mailing list