From f5d6b121a43cc9d2e60c02b84b66f61ecf312b41 Mon Sep 17 00:00:00 2001 From: gousaiyang Date: Mon, 26 Apr 2021 17:31:36 -0700 Subject: [PATCH] bpo-42128: Improve "Binding of names" doc section - Clarify that "assignment" includes both assignment statements and assignment expressions - Mention that pattern matching may bind names --- Doc/reference/executionmodel.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst index 55ac01b6a844dc..81094ea5bf538b 100644 --- a/Doc/reference/executionmodel.rst +++ b/Doc/reference/executionmodel.rst @@ -59,9 +59,10 @@ Binding of names The following constructs bind names: formal parameters to functions, :keyword:`import` statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers -if occurring in an assignment, :keyword:`for` loop header, or after -:keyword:`!as` in a :keyword:`with` statement or :keyword:`except` clause. -The :keyword:`!import` statement +if occurring in an assignment (statement or expression), :keyword:`for` loop +header, or after :keyword:`!as` in a :keyword:`with` statement or +:keyword:`except` clause. The :keyword:`!match` statement may bind names within +patterns upon successful pattern matches. The :keyword:`!import` statement of the form ``from ... import *`` binds all names defined in the imported module, except those beginning with an underscore. This form may only be used at the module level.