A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/071441.html below:

[Python-Dev] with_traceback

[Python-Dev] with_tracebackglyph at divmod.com glyph at divmod.com
Thu Mar 1 07:53:19 CET 2007
On Wed, 28 Feb 2007 18:10:21 -0800, Guido van Rossum <guido at python.org> 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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4