]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42086: Document AST operator nodes acts as a singleton (GH-22896)
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>
Thu, 22 Oct 2020 16:02:43 +0000 (19:02 +0300)
committerGitHub <noreply@github.com>
Thu, 22 Oct 2020 16:02:43 +0000 (09:02 -0700)
Automerge-Triggered-By: GH:gvanrossum
Doc/library/ast.rst

index f95ee1d5c69c212215bd7178ef7a501be24bb634..b8688ae61a4876d1d6f849adb6a8e95b86bfef5b 100644 (file)
@@ -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
 ------------------