From: Terry Reedy on
On 5/21/2010 7:22 PM, Zac Burns wrote:
> Why can't I inherit from traceback to 'spoof' tracebacks?

Because a) they are, at least in part, an internal implementation detail
of CPython, and b) even if you could, Python would use the builtin
original with exceptions, and c) you can probably do anything sensible
you want with them by wrapping them, as in, define a class with a
traceback as the main instance attribute.

From: exarkun on
On 01:42 am, tjreedy(a)udel.edu wrote:
>On 5/21/2010 7:22 PM, Zac Burns wrote:
>>Why can't I inherit from traceback to 'spoof' tracebacks?
>
>Because a) they are, at least in part, an internal implementation
>detail of CPython,

But you can just say this about anything, since there is no Python
specification. So it's mostly meaningless.
>and b) even if you could, Python would use the builtin original with
>exceptions,

Only if it were implemented that way. One could certainly an
implementation with different behavior.
>and c) you can probably do anything sensible you want with them by
>wrapping them, as in, define a class with a traceback as the main
>instance attribute.

Except you can't re-raise them.

Something like this feature has been proposed before. The only objects
that I've ever heard raised are that it's harder to implement on CPython
than anyone is willing to tackle.

Jean-Paul