>>> import sys >>> for i in range(-1, 100): print '%d: %s' % (i, sys._getframe(i).f_code.co_filename, ) -1: <pyshell#2> 0: <pyshell#2> 1: C:\Python25\lib\idlelib\run.py 2: C:\Python25\lib\idlelib\run.py 3: <string> Traceback (most recent call last): File "<pyshell#2>", line 2, in <module> print '%d: %s' % (i, sys._getframe(i).f_code.co_filename, ) ValueError: call stack is not deep enough