[Python-checkins] [3.10]bpo-45463: Clarify that global statements allows multiple names (GH-28851) (GH-28989)
terryjreedy
webhook-mailer at python.org
Sat Oct 16 10:01:59 EDT 2021
https://github.com/python/cpython/commit/855d6247adb39d4e38b698b89e519587318abd80
commit: 855d6247adb39d4e38b698b89e519587318abd80
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: terryjreedy <tjreedy at udel.edu>
date: 2021-10-16T10:01:54-04:00
summary:
[3.10]bpo-45463: Clarify that global statements allows multiple names (GH-28851) (GH-28989)
The global statement allows specifying a list of identifiers
(https://docs.python.org/3/reference/simple_stmts.htmlGH-the-global-statement).
The "Execution model" chapter described the global statement as if it
only allowed one single name. Pluralize "name" in the appropriate places.
(cherry picked from commit 4ecd119b007cb766b8bede2dc78b70d29cd932dd)
Co-authored-by: Luca Chiodini <luca at chiodini.org>
Co-authored-by: Luca Chiodini <luca at chiodini.org>
files:
M Doc/reference/executionmodel.rst
diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index 55ac01b6a844d..5c85dd7052d67 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -119,14 +119,14 @@ is subtle. Python lacks declarations and allows name binding operations to
occur anywhere within a code block. The local variables of a code block can be
determined by scanning the entire text of the block for name binding operations.
-If the :keyword:`global` statement occurs within a block, all uses of the name
-specified in the statement refer to the binding of that name in the top-level
+If the :keyword:`global` statement occurs within a block, all uses of the names
+specified in the statement refer to the bindings of those names in the top-level
namespace. Names are resolved in the top-level namespace by searching the
global namespace, i.e. the namespace of the module containing the code block,
and the builtins namespace, the namespace of the module :mod:`builtins`. The
-global namespace is searched first. If the name is not found there, the
+global namespace is searched first. If the names are not found there, the
builtins namespace is searched. The :keyword:`!global` statement must precede
-all uses of the name.
+all uses of the listed names.
The :keyword:`global` statement has the same scope as a name binding operation
in the same block. If the nearest enclosing scope for a free variable contains
More information about the Python-checkins
mailing list