Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
Created January 23, 2015 16:51
Show Gist options
  • Save WilliamQLiu/506530b03526b0c98e47 to your computer and use it in GitHub Desktop.
Save WilliamQLiu/506530b03526b0c98e47 to your computer and use it in GitHub Desktop.
Python See Docstring
# How to view the docstring of a function quickly
# https://www.python.org/dev/peps/pep-0257/
### View the docstring of a function
$print repr(foo.__doc__) # e.g. print repr(matplotlib.pyplot.plt.__doc__)
### Split the lines
$foo.__doc__.splitlines() # e.g. matplotlib.pyplot.plt.__doc__.splitlines()
### Trim any unnecessary lines - basically do this for best formatting
$trim(foo.__doc__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment