[Python-Dev] new draft of PEP 227
Jeremy Hylton
jeremy@alum.mit.edu
Thu, 14 Dec 2000 09:52:37 -0500 (EST)
>>>>> "MAL" == M -A Lemburg <mal@lemburg.com> writes:
MAL> Jeremy Hylton wrote:
>>
>> I've got a new draft of PEP 227. The terminology and wording are
>> more convoluted than they need to be. I'll do at least one
>> revision just to say things more clearly, but I'd appreciate
>> comments on the proposed spec if you can read the current draft.
MAL> The PEP doesn't mention the problems I pointed out about
MAL> breaking the lookup schemes w/r to symbols in methods, classes
MAL> and globals.
I believe it does. There was some discussion on python-dev and
with others in private email about how classes should be handled.
The relevant section of the specification is:
If a name is used within a code block, but it is not bound there
and is not declared global, the use is treated as a reference to
the nearest enclosing function region. (Note: If a region is
contained within a class definition, the name bindings that occur
in the class block are not visible to enclosed functions.)
MAL> Please add a comment about this to the PEP + maybe the example
MAL> I gave in one the posts to python-dev about it. I consider the
MAL> problem serious enough to limit the nested scoping to lambda
MAL> functions (or functions in general) only if that's possible.
If there was some other concern you had, then I don't know what it
was. I recall that you had a longish example that raised a NameError
immediately :-).
Jeremy