Skip to content

Instantly share code, notes, and snippets.

@turicas
Created December 19, 2011 16:51
Show Gist options
  • Select an option

  • Save turicas/1497945 to your computer and use it in GitHub Desktop.

Select an option

Save turicas/1497945 to your computer and use it in GitHub Desktop.
[Python] How to know function name inside it
#!/usr/bin/env python
import inspect
def some_function():
frame = inspect.currentframe()
function_name = frame.f_code.co_name
print 'This function name is:', function_name
some_function()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment