[Python-Dev] Explicit Lexical Scoping (pre-PEP?)
Fredrik Lundh
fredrik at pythonware.com
Tue Jul 11 08:45:49 CEST 2006
Talin wrote:
> I also think that it won't be a complete disaster if we do nothing at
> all - there *are* existing ways to deal with this problem; there are
> even some which aren't hackish and non-obvious. For example, its easy
> enough to create an object which acts as an artificial scope:
>
> def x():
> scope = object()
> scope.x = 1
> def y():
> scope.x = 2
>
> To my mind, the above code looks about as elegant and efficient as most
> of the proposals put forward so far, and it already works.
>
> How much are we really saving here by building this feature into the
> language?
I don't think anyone commented on my "mutable" post, but as I mentioned
in that post, if you look at the use cases for this, what most use cases
really need is *mutation*, not *rebinding*.
</F>
More information about the Python-Dev
mailing list