Need help with Python scoping rules
kj
no.email at please.post
Thu Aug 27 09:53:07 EDT 2009
In <4a967b2f$0$19301$426a74cc at news.free.fr> Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> writes:
>The only thing one is entitled to expect when learning a new language is
>that the language's implementation follows the language specs.
In fact, the official docs, when they discuss scopes, are off to
a bad start:
Names refer to objects. Names are introduced by name binding
operations. Each occurrence of a name in the program text refers
to the binding of that name established in the innermost function
block containing the use.
The first paragraph implies that binding can only occur within
functions, which is either incorrect, or presupposes a definition
of "function" that is not what most programmers would recognize.
In general, I found the docs very unclear on the subject of scoping.
PEP 227 is much better, but I wouldn't have thought of it as "the
specs".
kynn
More information about the Python-list
mailing list