Skip to content

Commit 94a7a4e

Browse files
authored
Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720)
* Replace: The :keyword:`global` -> The :keyword:`global` statement Add :keyword: when it's needed * Replace repeated links with duoble backticks
1 parent 3be7498 commit 94a7a4e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Doc/reference/simple_stmts.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ The extended form, ``assert expression1, expression2``, is equivalent to ::
408408

409409
These equivalences assume that :const:`__debug__` and :exc:`AssertionError` refer to
410410
the built-in variables with those names. In the current implementation, the
411-
built-in variable :const:`__debug__` is ``True`` under normal circumstances,
411+
built-in variable ``__debug__`` is ``True`` under normal circumstances,
412412
``False`` when optimization is requested (command line option :option:`-O`). The current
413-
code generator emits no code for an assert statement when optimization is
413+
code generator emits no code for an :keyword:`assert` statement when optimization is
414414
requested at compile time. Note that it is unnecessary to include the source
415415
code for the expression that failed in the error message; it will be displayed
416416
as part of the stack trace.
@@ -533,8 +533,8 @@ The :keyword:`!yield` statement
533533
yield_stmt: `yield_expression`
534534

535535
A :keyword:`yield` statement is semantically equivalent to a :ref:`yield
536-
expression <yieldexpr>`. The yield statement can be used to omit the parentheses
537-
that would otherwise be required in the equivalent yield expression
536+
expression <yieldexpr>`. The ``yield`` statement can be used to omit the
537+
parentheses that would otherwise be required in the equivalent yield expression
538538
statement. For example, the yield statements ::
539539

540540
yield <expr>
@@ -546,7 +546,7 @@ are equivalent to the yield expression statements ::
546546
(yield from <expr>)
547547

548548
Yield expressions and statements are only used when defining a :term:`generator`
549-
function, and are only used in the body of the generator function. Using yield
549+
function, and are only used in the body of the generator function. Using :keyword:`yield`
550550
in a function definition is sufficient to cause that definition to create a
551551
generator function instead of a normal function.
552552

@@ -966,12 +966,12 @@ The :keyword:`!global` statement
966966
.. productionlist:: python-grammar
967967
global_stmt: "global" `identifier` ("," `identifier`)*
968968

969-
The :keyword:`global` causes the listed identifiers to be interpreted
969+
The :keyword:`global` statement causes the listed identifiers to be interpreted
970970
as globals. It would be impossible to assign to a global variable without
971971
:keyword:`!global`, although free variables may refer to globals without being
972972
declared global.
973973

974-
The global statement applies to the entire scope of a function or
974+
The :keyword:`global` statement applies to the entire scope of a function or
975975
class body. A :exc:`SyntaxError` is raised if a variable is used or
976976
assigned to prior to its global declaration in the scope.
977977

@@ -1009,7 +1009,7 @@ identifiers. If a name is bound in more than one nonlocal scope, the
10091009
nearest binding is used. If a name is not bound in any nonlocal scope,
10101010
or if there is no nonlocal scope, a :exc:`SyntaxError` is raised.
10111011

1012-
The nonlocal statement applies to the entire scope of a function or
1012+
The :keyword:`nonlocal` statement applies to the entire scope of a function or
10131013
class body. A :exc:`SyntaxError` is raised if a variable is used or
10141014
assigned to prior to its nonlocal declaration in the scope.
10151015

0 commit comments

Comments
 (0)