diff options
author | Georg Brandl <georg@python.org> | 2008-06-07 15:59:10 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-06-07 15:59:10 (GMT) |
commit | 7be19aabe20a04d8038383bc96c3dd96f27892c0 (patch) | |
tree | 535f4ab7bff1301239a2c5f3f2d7492c0ab5634b /Doc/library/inspect.rst | |
parent | 6a5a177cba3aa36e53438901a1a52149b9010e92 (diff) | |
download | cpython-7be19aabe20a04d8038383bc96c3dd96f27892c0.zip cpython-7be19aabe20a04d8038383bc96c3dd96f27892c0.tar.gz cpython-7be19aabe20a04d8038383bc96c3dd96f27892c0.tar.bz2 |
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r-- | Doc/library/inspect.rst | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 4ee68f6..5af020e 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -376,13 +376,9 @@ Note: Retrieving source code ---------------------- - .. function:: getdoc(object) - Get the documentation string for an object. All tabs are expanded to spaces. To - clean up docstrings that are indented to line up with blocks of code, any - whitespace than can be uniformly removed from the second line onwards is - removed. + Get the documentation string for an object, cleaned up with :func:`cleandoc`. .. function:: getcomments(object) @@ -429,6 +425,15 @@ Retrieving source code cannot be retrieved. +.. function:: cleandoc(doc) + + Clean up indentation from docstrings that are indented to line up with blocks + of code. Any whitespace that can be uniformly removed from the second line + onwards is removed. Also, all tabs are expanded to spaces. + + .. versionadded:: 2.6 + + .. _inspect-classes-functions: Classes and functions |