Python Mystery Theatre -- Episode 1: Exceptions

Michael Hudson mwh at python.net
Mon Jul 14 18:58:05 CEST 2003


Erik Max Francis <max at alcyone.com> writes:

> "John J. Lee" wrote:
> 
> > Perhaps Erik was wondering, as I was, where that "<unprintable
> > instance
> > object>" came from.
> 
> Indeed.  I was quite aware of what was happening, just not clear on why
> his particular Python session said something that mine didn't.

It's probably a traceback.print_exc vs. the builtin traceback printing
stuff thing?

>>> class C(Exception):
...  def __init__(self):
...   pass
... 
>>> raise C
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
__main__.C>>> import traceback
>>> traceback.print_last()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
C: <unprintable instance object>

Seems so.

Cheers,
M.

-- 
  Any form of evilness that can be detected without *too* much effort
  is worth it...  I have no idea what kind of evil we're looking for
  here or how to detect is, so I can't answer yes or no.
                                       -- Guido Van Rossum, python-dev




More information about the Python-list mailing list