[Python-Dev] statically nested scopes
Wed, 1 Nov 2000 15:48:53 -0500 (EST)
>>>>> "MAL" == M -A Lemburg <firstname.lastname@example.org> writes:
MAL> [pre-PEP] This will break code... I'm not sure whether it's
MAL> worth going down this path just for the sake of being able to
MAL> define functions within functions.
How will this break code? Any code written to use the scoping rules
will not work today.
Python already allows programs to define functions within functions.
That's not at issue. The issue is how hard it is to use nested
functions, including lambdas.
MAL> Wouldn't it be a better idea to somehow add native acqusition
MAL> to Python's objects ?
Seriously, I don't see how acquistion addresses the same issues at
all. Feel free to explain what you mean.
MAL> We already have a slot which implements the "contains"
MAL> relationship. All we'd need is a way for a contained object to
MAL> register itself with the container in a way that doesn't
MAL> produce cycles.
The contains relationship has to do with container objects and their
contents. A function's environment is not a container in the same
sense, so I don't see how this is related.
As I noted in the PEP, I don't see a compelling reason to avoid