[3.9] bpo-42086: Document AST operator nodes acts as a singleton (GH-22896) (GH-22897)

Automerge-Triggered-By: GH:gvanrossum
(cherry picked from commit b37c994e5a)


Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-11-13 01:05:41 -08:00 committed by GitHub
parent 7ae19ef5cf
commit bc77704783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View 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
------------------