Last active
March 14, 2016 22:25
-
-
Save abhigenie92/ef7c16deceef2f9fb9e1 to your computer and use it in GitHub Desktop.
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 f2(): | |
curframe = inspect.currentframe() | |
calframe = inspect.getouterframes(curframe, 2) | |
print 'caller name:', calframe[1][3] | |
if __name__ == '__main__': | |
f2() | |
Output running the above script: | |
caller name: <module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment