On Wed, 28 Feb 2007 18:10:21 -0800, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>I am beginning to think that there are serious problems with attaching
>the traceback to the exception; I really don't like the answer that
>pre-creating an exception is unpythonic in Py3k.

In Twisted, to deal with asynchronous exceptions, we needed an object to 
specifically represent a "raised exception", i.e. an Exception instance with 
its attached traceback and methods to manipulate it.

You can find its API here:

http://twistedmatrix.com/documents/current/api/twisted.python.failure.Failure.html

Perhaps the use-cases for attaching the traceback object to the exception would 
be better satisfied by simply having sys.exc_info() return an object with 
methods like Failure?  Reading the "motivation" section of PEP 344, it 
describes  "passing these three things in parallel" as "tedious and 
error-prone".  Having one object one could call methods on instead of a 3-tuple 
which needed to be selectively passed on would simplify things.

For example, chaining could be accomplished by doing something like this:

    sys.current_exc_thingy().chain()

I can't think of a good name for the new object type, since "traceback", 
"error", "exception" and "stack" all already mean things in Python.
_______________________________________________
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