Created
May 7, 2014 09:03
-
-
Save akscram/7d7adc475bede56fe612 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 print_stack(): | |
print(" -> ".join( | |
"{0}:{1}".format(stack[1], stack[2]) | |
for stack in inspect.stack() | |
)) | |
print_stack() | |
def some(): | |
print_stack() | |
def k(): | |
some() | |
k() |
import inspect
def print_line():
stack = inspect.stack()[1]
print("{0}:{1}".format(stack[1], stack[2]))
print_line()
def some():
print_line()
def k():
some()
k()
foo.py:7
foo.py:10
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ python inspecting.py
inspecting.py:6 -> inspecting.py:9
inspecting.py:6 -> inspecting.py:12 -> inspecting.py:16 -> inspecting.py:18