Skip to content

Instantly share code, notes, and snippets.

@illbebach
Last active December 9, 2020 00:14
Show Gist options
  • Save illbebach/1d248a48f8b3e0bcdb40795c40c1009a to your computer and use it in GitHub Desktop.
Save illbebach/1d248a48f8b3e0bcdb40795c40c1009a to your computer and use it in GitHub Desktop.
get your python function name
import inspect
def get_func_name() -> str:
''' return a string of the caller's function name '''
return inspect.currentframe().f_back.f_code.co_name
def func1(arg1, arg2):
print(get_func_name(), arg1, arg2)
func1(1,2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment