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 | ncoghlan at gmail.com | Brisbane, Australia ---------------------------------------------------------------
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4