Created
February 6, 2019 14:19
-
-
Save mwrites/2409183524e9353ac9a03c8364adfb93 to your computer and use it in GitHub Desktop.
Python get function caller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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