Skip to content

Commit

Permalink
bpo-42086: Document AST operator nodes acts as a singleton (GH-22896)
Browse files Browse the repository at this point in the history
Automerge-Triggered-By: GH:gvanrossum
  • Loading branch information
isidentical committed Oct 22, 2020
1 parent b52432c commit b37c994
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,13 @@ Async and await
fields as :class:`For` and :class:`With`, respectively. Only valid in the
body of an :class:`AsyncFunctionDef`.

.. note::
When a string is parsed by :func:`ast.parse`, operator nodes (subclasses
of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`,
:class:`ast.boolop` and :class:`ast.expr_context`) on the returned tree
will be singletons. Changes to one will be reflected in all other
occurrences of the same value (e.g. :class:`ast.Add`).


:mod:`ast` Helpers
------------------
Expand Down

0 comments on commit b37c994

Please sign in to comment.