Greg Ewing wrote: > 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__
I'm not sure what build you're getting that behaviour on, but my svn build of 2.6 has a __class__ attribute for traceback objects, as does the kubuntu 9.10 python 2.6.4 system install. >>> try: ... raise ValueError ... except: ... import sys ... tb = sys.exc_info()[2] ... print type(tb) ... print dir(tb) ... print tb.__class__ ... <type 'traceback'> ['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'tb_frame', 'tb_lasti', 'tb_lineno', 'tb_next'] <type 'traceback'> Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com