I was looking for a generic way to extract the name of the current method (or function) in python. Here is one way to do it -
import sys
method_name = sys._getframe().f_code.co_name
print(method_name)
I was looking for a generic way to extract the name of the current method (or function) in python. Here is one way to do it -
import sys
method_name = sys._getframe().f_code.co_name
print(method_name)