Created
December 19, 2011 16:51
-
-
Save turicas/1497945 to your computer and use it in GitHub Desktop.
[Python] How to know function name inside it
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
| #!/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