summaryrefslogtreecommitdiffstats
path: root/Doc/library/ast.rst
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-02-22 15:31:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-02-22 15:31:59 (GMT)
commitcb41b2766de646435743b6af7dd152751b54e73f (patch)
tree4033a04617524787defe4699c45327783fe44d8d /Doc/library/ast.rst
parent1bc156430bad8177b5beecf57979628c1d071230 (diff)
downloadcpython-cb41b2766de646435743b6af7dd152751b54e73f.zip
cpython-cb41b2766de646435743b6af7dd152751b54e73f.tar.gz
cpython-cb41b2766de646435743b6af7dd152751b54e73f.tar.bz2
bpo-29463: Add docstring field to some AST nodes. (#46)
* bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
Diffstat (limited to 'Doc/library/ast.rst')
-rw-r--r--Doc/library/ast.rst14
1 files changed, 11 insertions, 3 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 8d4ae2c..bda46f4 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -133,9 +133,17 @@ and classes for traversing abstract syntax trees:
.. function:: get_docstring(node, clean=True)
Return the docstring of the given *node* (which must be a
- :class:`FunctionDef`, :class:`ClassDef` or :class:`Module` node), or ``None``
- if it has no docstring. If *clean* is true, clean up the docstring's
- indentation with :func:`inspect.cleandoc`.
+ :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`,
+ or :class:`Module` node), or ``None`` if it has no docstring.
+ If *clean* is true, clean up the docstring's indentation with
+ :func:`inspect.cleandoc`.
+
+ .. versionchanged:: 3.5
+ :class:`AsyncFunctionDef` is now supported.
+
+ .. versionchanged:: 3.7
+ The docstring is now exported from the node docstring field, instead of
+ the first body statement.
.. function:: fix_missing_locations(node)