[Python-Dev] Re: PEP-317

Walter Dörwald walter@livinglogic.de
Tue, 10 Jun 2003 20:47:27 +0200


Steven Taschuk wrote:

> [...]
> I would also like the traceback to be an attribute of the
> exception object (circular references be damned!), specified by
> optional keyword argument to Exception.__init__.  This would
> require that people writing their own exception classes be sure to
> extend, not override, Exception.__init__.

Wouldn't it make more sense to associate the traceback with the
exception instance when the exception is raised, not when the
exception is instantiated? As long as the exception isn't raised
it's just a normal object without a traceback attached.

The warning framework and PEP 293 use unraised exceptions for passing
around error information, it would be bad if the would gain traceback
info automatically.

Bye,
    Walter Dörwald