Skip to content

Instantly share code, notes, and snippets.

@abhigenie92
Last active March 14, 2016 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhigenie92/ef7c16deceef2f9fb9e1 to your computer and use it in GitHub Desktop.
Save abhigenie92/ef7c16deceef2f9fb9e1 to your computer and use it in GitHub Desktop.
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