Skip to content

Commit 739ab0d

Browse files
committed
Consistent spacing is a pre-requisite to consistently good writing.
1 parent b74fb8e commit 739ab0d

File tree

9 files changed

+756
-756
lines changed

9 files changed

+756
-756
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 99 additions & 99 deletions
Large diffs are not rendered by default.

Doc/reference/datamodel.rst

Lines changed: 207 additions & 207 deletions
Large diffs are not rendered by default.

Doc/reference/executionmodel.rst

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Structure of a program
1919
A Python program is constructed from code blocks.
2020
A :dfn:`block` is a piece of Python program text that is executed as a unit.
2121
The following are blocks: a module, a function body, and a class definition.
22-
Each command typed interactively is a block. A script file (a file given as
22+
Each command typed interactively is a block. A script file (a file given as
2323
standard input to the interpreter or specified as a command line argument to the
24-
interpreter) is a code block. A script command (a command specified on the
24+
interpreter) is a code block. A script command (a command specified on the
2525
interpreter command line with the :option:`-c` option) is a code block.
2626
A module run as a top level script (as module ``__main__``) from the command
2727
line using a :option:`-m` argument is also a code block. The string
@@ -30,7 +30,7 @@ code block.
3030

3131
.. index:: pair: execution; frame
3232

33-
A code block is executed in an :dfn:`execution frame`. A frame contains some
33+
A code block is executed in an :dfn:`execution frame`. A frame contains some
3434
administrative information (used for debugging) and determines where and how
3535
execution continues after the code block's execution has completed.
3636

@@ -52,7 +52,7 @@ Binding of names
5252
single: name
5353
pair: binding; name
5454

55-
:dfn:`Names` refer to objects. Names are introduced by name binding operations.
55+
:dfn:`Names` refer to objects. Names are introduced by name binding operations.
5656

5757
.. index:: single: from; import statement
5858

@@ -87,9 +87,9 @@ function definition or at the module level (the top-level code block).
8787
.. index:: pair: free; variable
8888

8989
If a name is bound in a block, it is a local variable of that block, unless
90-
declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at
91-
the module level, it is a global variable. (The variables of the module code
92-
block are local and global.) If a variable is used in a code block but not
90+
declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at
91+
the module level, it is a global variable. (The variables of the module code
92+
block are local and global.) If a variable is used in a code block but not
9393
defined there, it is a :term:`free variable`.
9494

9595
Each occurrence of a name in the program text refers to the :dfn:`binding` of
@@ -102,16 +102,16 @@ Resolution of names
102102

103103
.. index:: scope
104104

105-
A :dfn:`scope` defines the visibility of a name within a block. If a local
106-
variable is defined in a block, its scope includes that block. If the
105+
A :dfn:`scope` defines the visibility of a name within a block. If a local
106+
variable is defined in a block, its scope includes that block. If the
107107
definition occurs in a function block, the scope extends to any blocks contained
108108
within the defining one, unless a contained block introduces a different binding
109109
for the name.
110110

111111
.. index:: single: environment
112112

113113
When a name is used in a code block, it is resolved using the nearest enclosing
114-
scope. The set of all such scopes visible to a code block is called the block's
114+
scope. The set of all such scopes visible to a code block is called the block's
115115
:dfn:`environment`.
116116

117117
.. index::
@@ -125,26 +125,26 @@ used, an :exc:`UnboundLocalError` exception is raised.
125125
:exc:`UnboundLocalError` is a subclass of :exc:`NameError`.
126126

127127
If a name binding operation occurs anywhere within a code block, all uses of the
128-
name within the block are treated as references to the current block. This can
129-
lead to errors when a name is used within a block before it is bound. This rule
130-
is subtle. Python lacks declarations and allows name binding operations to
131-
occur anywhere within a code block. The local variables of a code block can be
128+
name within the block are treated as references to the current block. This can
129+
lead to errors when a name is used within a block before it is bound. This rule
130+
is subtle. Python lacks declarations and allows name binding operations to
131+
occur anywhere within a code block. The local variables of a code block can be
132132
determined by scanning the entire text of the block for name binding operations.
133133
See :ref:`the FAQ entry on UnboundLocalError <faq-unboundlocalerror>`
134134
for examples.
135135

136136
If the :keyword:`global` statement occurs within a block, all uses of the names
137137
specified in the statement refer to the bindings of those names in the top-level
138-
namespace. Names are resolved in the top-level namespace by searching the
138+
namespace. Names are resolved in the top-level namespace by searching the
139139
global namespace, i.e. the namespace of the module containing the code block,
140-
and the builtins namespace, the namespace of the module :mod:`builtins`. The
141-
global namespace is searched first. If the names are not found there, the
140+
and the builtins namespace, the namespace of the module :mod:`builtins`. The
141+
global namespace is searched first. If the names are not found there, the
142142
builtins namespace is searched next. If the names are also not found in the
143143
builtins namespace, new variables are created in the global namespace.
144144
The global statement must precede all uses of the listed names.
145145

146146
The :keyword:`global` statement has the same scope as a name binding operation
147-
in the same block. If the nearest enclosing scope for a free variable contains
147+
in the same block. If the nearest enclosing scope for a free variable contains
148148
a global statement, the free variable is treated as a global.
149149

150150
.. XXX say more about "nonlocal" semantics here
@@ -158,7 +158,7 @@ cannot be rebound with the :keyword:`!nonlocal` statement.
158158
.. index:: pair: module; __main__
159159

160160
The namespace for a module is automatically created the first time a module is
161-
imported. The main module for a script is always called :mod:`__main__`.
161+
imported. The main module for a script is always called :mod:`__main__`.
162162

163163
Class definition blocks and arguments to :func:`exec` and :func:`eval` are
164164
special in the context of name resolution.
@@ -301,14 +301,14 @@ Builtins and restricted execution
301301
.. impl-detail::
302302

303303
Users should not touch ``__builtins__``; it is strictly an implementation
304-
detail. Users wanting to override values in the builtins namespace should
304+
detail. Users wanting to override values in the builtins namespace should
305305
:keyword:`import` the :mod:`builtins` module and modify its
306306
attributes appropriately.
307307

308308
The builtins namespace associated with the execution of a code block
309309
is actually found by looking up the name ``__builtins__`` in its
310310
global namespace; this should be a dictionary or a module (in the
311-
latter case the module's dictionary is used). By default, when in the
311+
latter case the module's dictionary is used). By default, when in the
312312
:mod:`__main__` module, ``__builtins__`` is the built-in module
313313
:mod:`builtins`; when in any other module, ``__builtins__`` is an
314314
alias for the dictionary of the :mod:`builtins` module itself.
@@ -331,11 +331,11 @@ This means that the following code will print 42::
331331
.. XXX from * also invalid with relative imports (at least currently)
332332
333333
The :func:`eval` and :func:`exec` functions do not have access to the full
334-
environment for resolving names. Names may be resolved in the local and global
335-
namespaces of the caller. Free variables are not resolved in the nearest
336-
enclosing namespace, but in the global namespace. [#]_ The :func:`exec` and
334+
environment for resolving names. Names may be resolved in the local and global
335+
namespaces of the caller. Free variables are not resolved in the nearest
336+
enclosing namespace, but in the global namespace. [#]_ The :func:`exec` and
337337
:func:`eval` functions have optional arguments to override the global and local
338-
namespace. If only one namespace is specified, it is used for both.
338+
namespace. If only one namespace is specified, it is used for both.
339339

340340
.. XXX(ncoghlan) above is only accurate for string execution. When executing code objects,
341341
closure cells may now be passed explicitly to resolve co_freevars references.
@@ -356,15 +356,15 @@ Exceptions
356356
single: error handling
357357

358358
Exceptions are a means of breaking out of the normal flow of control of a code
359-
block in order to handle errors or other exceptional conditions. An exception
359+
block in order to handle errors or other exceptional conditions. An exception
360360
is *raised* at the point where the error is detected; it may be *handled* by the
361361
surrounding code block or by any code block that directly or indirectly invoked
362362
the code block where the error occurred.
363363

364364
The Python interpreter raises an exception when it detects a run-time error
365-
(such as division by zero). A Python program can also explicitly raise an
365+
(such as division by zero). A Python program can also explicitly raise an
366366
exception with the :keyword:`raise` statement. Exception handlers are specified
367-
with the :keyword:`try` ... :keyword:`except` statement. The :keyword:`finally`
367+
with the :keyword:`try` ... :keyword:`except` statement. The :keyword:`finally`
368368
clause of such a statement can be used to specify cleanup code which does not
369369
handle the exception, but is executed whether an exception occurred or not in
370370
the preceding code.
@@ -379,18 +379,18 @@ re-entering the offending piece of code from the top).
379379
.. index:: single: SystemExit (built-in exception)
380380

381381
When an exception is not handled at all, the interpreter terminates execution of
382-
the program, or returns to its interactive main loop. In either case, it prints
382+
the program, or returns to its interactive main loop. In either case, it prints
383383
a stack traceback, except when the exception is :exc:`SystemExit`.
384384

385-
Exceptions are identified by class instances. The :keyword:`except` clause is
385+
Exceptions are identified by class instances. The :keyword:`except` clause is
386386
selected depending on the class of the instance: it must reference the class of
387387
the instance or a :term:`non-virtual base class <abstract base class>` thereof.
388388
The instance can be received by the handler and can carry additional information
389389
about the exceptional condition.
390390

391391
.. note::
392392

393-
Exception messages are not part of the Python API. Their contents may change
393+
Exception messages are not part of the Python API. Their contents may change
394394
from one version of Python to the next without warning and should not be
395395
relied on by code which will run under multiple versions of the interpreter.
396396

0 commit comments

Comments
 (0)