diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 039fe41f189..ef36f50235f 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -127,9 +127,9 @@ The abstract grammar is currently defined as follows: Apart from the node classes, :mod:`ast` module defines these utility functions and classes for traversing abstract syntax trees: -.. function:: parse(expr, filename='', mode='exec') +.. function:: parse(source, filename='', mode='exec') - Parse an expression into an AST node. Equivalent to ``compile(expr, + Parse the source into an AST node. Equivalent to ``compile(source, filename, mode, ast.PyCF_ONLY_AST)``. diff --git a/Lib/ast.py b/Lib/ast.py index 7f35f182e98..fd5dfdba676 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -29,12 +29,12 @@ from _ast import * from _ast import __version__ -def parse(expr, filename='', mode='exec'): +def parse(source, filename='', mode='exec'): """ - Parse an expression into an AST node. - Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST). + Parse the source into an AST node. + Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). """ - return compile(expr, filename, mode, PyCF_ONLY_AST) + return compile(source, filename, mode, PyCF_ONLY_AST) def literal_eval(node_or_string):