Skip to content

Instantly share code, notes, and snippets.

@mwrites
Created February 6, 2019 14:19
Show Gist options
  • Save mwrites/2409183524e9353ac9a03c8364adfb93 to your computer and use it in GitHub Desktop.
Save mwrites/2409183524e9353ac9a03c8364adfb93 to your computer and use it in GitHub Desktop.
Python get function caller
import inspect
def f1(): f2()
def f2():
print 'caller name:', inspect.stack()[1][3]
f1()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment