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):
I would like a built in way that gives me a string 'someClass'
2) Similar with functions. If I have
def someFunction():
....
print builtinMethodToGetFunctionNameAsString
return
it would print 'someFunction'
The reason why I am looking for this is, that I have a bit of a jungle of classes and subclasses and for debugging I would like to print where I am, so to all methods I would just want to add something along the lines
print 'Executing %s from %s' %(getFunctionName,getClassName)
So I am looking for a generic command that know the class and the function where it is, so that I can copy and paste the line in all the methods without having to write a separate line for each of them