On this page
inspect.getdoc
Prev: inspect.getcoroutinestate | Up: inspect | Next: inspect.getfile
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getdoc
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getdoc
Signature & Overview
inspect.getdoc(object)
Get the documentation string for an object.
Usage
import inspect
def fn():
"""First line.
Second line.
"""
assert inspect.getdoc(fn) == "First line.\n\nSecond line."
Gotchas
- Inherits docstrings from base classes for methods: Also runs
cleandoc()automatically, unlike rawfn.__doc__.
REPL Inspect
from inspect import getdoc
help(getdoc)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getcoroutinestate Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getfile Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib