It is actually 2 questions. 1) Is there a generic way to get the class name of an instance, so if I have a class
class someClass(object):
the function part has already been answered at this SO post. The code would be:
import sys print sys._getframe().f_code.co_name
For the class part, use: A.__name__ or A().__class__.__name (for an instance)
A.__name__
A().__class__.__name