Guido van Rossum wrote:

> Since this can conceivably be going on in parallel in multiple
> threads, we really don't ever want to be sharing whatever object
> contains the head of the chain of tracebacks since it mutates at every
> frame bubble-up.

So (full) exceptions can't be unitary objects.

In theory, raising an already-instantiated instance could indicate "no
traceback", which could make pre-cooked exceptions even lighter.

Otherwise, there is no way to make exceptions reference their
traceback directly.  Using a property which depends on both the
exception and the frame asking (catching frame?  thread?) is ...
probably worse than keeping them separate.

    >>> except MyException as err, tb

isn't so awful, and makes it clear that the traceback is no longer
needed after the more typical

    >>> except MyException as err
    ...         # no raise statements needing a context or cause


-jJ
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to