Stack Inspection

Question

Inspecting the Stack in Python.

Solution

import sys
def foo():
    """blah"""
    print sys._getframe().f_back.f_locals[sys._getframe().f_code.co_name].__doc__

foo()
Run this
Comments by Disqus