I have a function that takes another function as a parameter. If the function is a member of a class, I need to find the name of that class. E.g.
def analyse
Please use following function to get method names inside of a class
def getLocalMethods(clss):
import types
# This is a helper function for the test function below.
# It returns a sorted list of the names of the methods
# defined in a class. It's okay if you don't fully understand it!
result = [ ]
for var in clss.__dict__:
val = clss.__dict__[var]
if (isinstance(val, types.FunctionType)):
result.append(var)
return sorted(result)