[Python-Dev] Traceback object has no __class__?

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Apr 11 12:43:14 CEST 2010


I thought type-class unification was supposed to mean
that all objects now have a __class__ attribute. But
traceback objects don't seem to:

import sys

try:
   raise ValueError
except ValueError:
   tb = sys.exc_info()[2]
   print tb
   print tb.__class__

results in:

% python2.6 traceback_class.py
<traceback object at 0x82dc8>
Traceback (most recent call last):
   File "traceback_class.py", line 8, in <module>
     print tb.__class__
AttributeError: __class__

-- 
Greg


More information about the Python-Dev mailing list