Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,20 @@ and classes for traversing abstract syntax trees:
Omit optional ``Load()`` values by default.


.. function:: compare(a, b, /, *, compare_attributes=False)

Recursively compares two ASTs.

*compare_attributes* affects whether AST attributes are considered
in the comparison. If *compare_attributes* is ``False`` (default), then
attributes are ignored. Otherwise they must all be equal. This
option is useful to check whether the ASTs are structurally equal but
differ in whitespace or similar details. Attributes include line numbers
and column offsets.

.. versionadded:: 3.14


.. _ast-compiler-flags:

Compiler flags
Expand Down Expand Up @@ -2563,20 +2577,6 @@ effects on the compilation of a program:
.. versionadded:: 3.8


.. function:: compare(a, b, /, *, compare_attributes=False)

Recursively compares two ASTs.

*compare_attributes* affects whether AST attributes are considered
in the comparison. If *compare_attributes* is ``False`` (default), then
attributes are ignored. Otherwise they must all be equal. This
option is useful to check whether the ASTs are structurally equal but
differ in whitespace or similar details. Attributes include line numbers
and column offsets.

.. versionadded:: 3.14


.. _ast-cli:

Command-line usage
Expand Down
Loading