In Python, how do I get a function name as a string, without calling the function?
def my_function(): pass print get_function_name_as_string(my_function
import inspect def foo(): print(inspect.stack()[0][3])
where
stack()[0] is the caller
stack()[0]
stack()[3] is the string name of the method
stack()[3]