@@ -406,9 +406,9 @@ The extended form, ``assert expression1, expression2``, is equivalent to ::
406406
407407These equivalences assume that :const: `__debug__ ` and :exc: `AssertionError ` refer to
408408the built-in variables with those names. In the current implementation, the
409- built-in variable :const: ` __debug__ ` is ``True `` under normal circumstances,
409+ built-in variable `` __debug__ ` ` is ``True `` under normal circumstances,
410410``False `` when optimization is requested (command line option :option: `-O `). The current
411- code generator emits no code for an assert statement when optimization is
411+ code generator emits no code for an :keyword: ` assert ` statement when optimization is
412412requested at compile time. Note that it is unnecessary to include the source
413413code for the expression that failed in the error message; it will be displayed
414414as part of the stack trace.
@@ -531,8 +531,8 @@ The :keyword:`!yield` statement
531531 yield_stmt: `yield_expression `
532532
533533A :keyword: `yield ` statement is semantically equivalent to a :ref: `yield
534- expression <yieldexpr>`. The yield statement can be used to omit the parentheses
535- that would otherwise be required in the equivalent yield expression
534+ expression <yieldexpr>`. The `` yield `` statement can be used to omit the
535+ parentheses that would otherwise be required in the equivalent yield expression
536536statement. For example, the yield statements ::
537537
538538 yield <expr>
@@ -544,7 +544,7 @@ are equivalent to the yield expression statements ::
544544 (yield from <expr>)
545545
546546Yield expressions and statements are only used when defining a :term: `generator `
547- function, and are only used in the body of the generator function. Using yield
547+ function, and are only used in the body of the generator function. Using :keyword: ` yield `
548548in a function definition is sufficient to cause that definition to create a
549549generator function instead of a normal function.
550550
@@ -964,25 +964,14 @@ The :keyword:`!global` statement
964964.. productionlist :: python-grammar
965965 global_stmt: "global" `identifier ` ("," `identifier `)*
966966
967- The :keyword: `global ` statement is a declaration which holds for the entire
968- current code block. It means that the listed identifiers are to be interpreted
969- as globals. It would be impossible to assign to a global variable without
967+ The :keyword: `global ` statement causes the listed identifiers to be interpreted
968+ as globals. It would be impossible to assign to a global variable without
970969:keyword: `!global `, although free variables may refer to globals without being
971970declared global.
972971
973- Names listed in a :keyword: `global ` statement must not be used in the same code
974- block textually preceding that :keyword: `!global ` statement.
975-
976- Names listed in a :keyword: `global ` statement must not be defined as formal
977- parameters, or as targets in :keyword: `with ` statements or :keyword: `except ` clauses, or in a :keyword: `for ` target list, :keyword: `class `
978- definition, function definition, :keyword: `import ` statement, or variable
979- annotation.
980-
981- .. impl-detail ::
982-
983- The current implementation does not enforce some of these restrictions, but
984- programs should not abuse this freedom, as future implementations may enforce
985- them or silently change the meaning of the program.
972+ The :keyword: `global ` statement applies to the entire scope of a function or
973+ class body. A :exc: `SyntaxError ` is raised if a variable is used or
974+ assigned to prior to its global declaration in the scope.
986975
987976.. index ::
988977 pair: built-in function; exec
@@ -1018,7 +1007,7 @@ identifiers. If a name is bound in more than one nonlocal scope, the
10181007nearest binding is used. If a name is not bound in any nonlocal scope,
10191008or if there is no nonlocal scope, a :exc: `SyntaxError ` is raised.
10201009
1021- The nonlocal statement applies to the entire scope of a function or
1010+ The :keyword: ` nonlocal ` statement applies to the entire scope of a function or
10221011class body. A :exc: `SyntaxError ` is raised if a variable is used or
10231012assigned to prior to its nonlocal declaration in the scope.
10241013
0 commit comments