[Python-ideas] immutable classes [was: pre-PEP: Default Argument Expressions]
jcarlson at uci.edu
Sun Feb 25 23:45:08 CET 2007
"Jan Kanis" <jan.kanis at phil.uu.nl> wrote:
> On Tue, 20 Feb 2007 00:17:53 +0100, Josiah Carlson <jcarlson at uci.edu>
> > "Jan Kanis" <jan.kanis at phil.uu.nl> wrote:
> >> <mode=dreaming> I just hope if
> >> python were designed today it would have done these. </mode>
> > Probably not. Value binding breaks closures.
> That depends on how you exactly define closures. The basics of having an
> inner function with free variables and initializing those free variables
> to the values they have in the parent scope still works.
It would break closures as defined for Python version 1.? to Python 2.5,
Python 3.x, and beyond.
Changing the semantics of Python closures is not the right thing to do,
whether in 2.6, 3.x or otherwise.
More information about the Python-ideas