Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3db68e

Browse files
authored
gh-48496: Added example and link to faq for UnboundLocalError in reference (#93068)
1 parentad23da0 commitf3db68e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎Doc/faq/programming.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Yes. The coding style required for standard library modules is documented as
113113
Core Language
114114
=============
115115

116+
.. _faq-unboundlocalerror:
117+
116118
Why am I getting an UnboundLocalError when the variable has a value?
117119
--------------------------------------------------------------------
118120

‎Doc/reference/executionmodel.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ lead to errors when a name is used within a block before it is bound. This rule
128128
is subtle. Python lacks declarations and allows name binding operations to
129129
occur anywhere within a code block. The local variables of a code block can be
130130
determined by scanning the entire text of the block for name binding operations.
131+
See:ref:`the FAQ entry on UnboundLocalError<faq-unboundlocalerror>`
132+
for examples.
131133

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp