summaryrefslogtreecommitdiffstats
path: root/Doc/library/ast.rst
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2020-10-22 16:02:43 (GMT)
committerGitHub <noreply@github.com>2020-10-22 16:02:43 (GMT)
commitb37c994e5ac73268abe23c52005b80cdca099793 (patch)
treec62a8835532fd5beb9c23a688d8147459687cc94 /Doc/library/ast.rst
parentb52432cb8cd7f5f1fc71ea3b7c0ea11573d504f0 (diff)
downloadcpython-b37c994e5ac73268abe23c52005b80cdca099793.zip
cpython-b37c994e5ac73268abe23c52005b80cdca099793.tar.gz
cpython-b37c994e5ac73268abe23c52005b80cdca099793.tar.bz2
bpo-42086: Document AST operator nodes acts as a singleton (GH-22896)
Automerge-Triggered-By: GH:gvanrossum
Diffstat (limited to 'Doc/library/ast.rst')
-rw-r--r--Doc/library/ast.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index f95ee1d..b8688ae 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -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
------------------