Kirk Strauser wrote: > Given a class: > >>>> class foo(object): >>>> pass > > how can I find its name, such as: > >>>> b = foo >>>> print something(b) > 'foo' > > I'm writing a trace() decorator for the sake of practice, and am trying to > print the name of the class that a traced method belongs to. This seems > like it should be easy, but I think I've been staring at the problem too > long.
print print b.__class__.__name__ gives what you want -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list