Skip to content

Commit 260e171

Browse files
committed
Remove example as FAQ already contains one
1 parent 8e34c35 commit 260e171

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

Doc/reference/executionmodel.rst

+3-15
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,11 @@ used, an :exc:`UnboundLocalError` exception is raised.
125125
If a name binding operation occurs anywhere within a code block, all uses of the
126126
name within the block are treated as references to the current block. This can
127127
lead to errors when a name is used within a block before it is bound. This rule
128-
is subtle::
129-
130-
>>> x = 1
131-
>>> def new_scope():
132-
... print(x)
133-
... x = 2
134-
...
135-
>>> new_scope()
136-
Traceback (most recent call last):
137-
File "<stdin>", line 1, in <module>
138-
File "<stdin>", line 2, in new_scope
139-
UnboundLocalError: local variable 'x' referenced before assignment
140-
141-
Python lacks declarations and allows name binding operations to
128+
is subtle. Python lacks declarations and allows name binding operations to
142129
occur anywhere within a code block. The local variables of a code block can be
143130
determined by scanning the entire text of the block for name binding operations.
144-
See also :ref:`the FAQ entry on UnboundLocalError <faq-unboundlocalerror>`.
131+
See :ref:`the FAQ entry on UnboundLocalError <faq-unboundlocalerror>` for some
132+
examples.
145133

146134
If the :keyword:`global` statement occurs within a block, all uses of the names
147135
specified in the statement refer to the bindings of those names in the top-level

0 commit comments

Comments
 (0)