Created
May 8, 2013 05:16
-
-
Save semeltheone/5538373 to your computer and use it in GitHub Desktop.
Getting the source code and doc comments of a given python function. See http://docs.python.org/2/library/inspect.html for more info about introspection.
This file contains 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
from inspect import * | |
def testFunction(unusedParameter): | |
"""Test introspection in python. | |
:param unusedParameter: A unused parameter | |
""" | |
a = 'test' | |
b = a | |
c = b | |
return c | |
print getsource(testFunction) | |
print getdoc(testFunction) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment