Determine function name from within that function

Is there a way to determine a function's name from within the function?

def foo():
    print("my name is", __myname__)  # <== how do I calculate this at runtime?

In the example above, the body of foo will somehow access the function name "foo" without hard-coding it. The output would be:

>>> foo()
my name is foo

← Назад к списку