[issue5763] scope resolving error
Mark Dickinson
report at bugs.python.org
Wed Apr 15 17:44:45 CEST 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
This is not a bug, just a common gotcha. The rules are
described at:
http://docs.python.org/reference/executionmodel.html#naming
Here's the relevant excerpt:
"""If a name binding operation occurs anywhere within a code block, all
uses of the name within the block are treated as references to the
current block. This can lead to errors when a name is used within a
block before it is bound. This rule is subtle. Python lacks declarations
and allows name binding operations to occur anywhere within a code
block. The local variables of a code block can be determined by scanning
the entire text of the block for name binding operations."""
----------
nosy: +marketdickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5763>
_______________________________________
More information about the Python-bugs-list
mailing list