R: [Python-Dev] Deprecating string exceptions

Guido van Rossum guido@python.org
Thu, 28 Mar 2002 08:57:24 -0500


> The traceback object could be part of the exception object, just like
> Java does it. When we have an exception that wraps another exception,
> both tracebacks would then be available.

I think you can do this now, though not in a standard way: the
wrapping exception would have to retrieve the traceback using
sys.exc_info(), and then store it as an instance variable.

> That's not exactly an implementation benefit, but an application
> benefit.

That's OK; I like application benefits better than implementation
benefits to motivate feature!

Maybe we should try to migrate to doing it this way in the future.
With the traceback in the exception object, there's no need to call
sys.exc_info() any more!

It does mean that the exception object gets modified as it is passed
along from frame to frame searching for an exception handler,
accumulating traceback info.  I think that's fine.

If people like this idea enough, perhaps it could be PEPped?

--Guido van Rossum (home page: http://www.python.org/~guido/)