[Python-ideas] immutable classes [was: pre-PEP: Default Argument Expressions]
Jan Kanis
jan.kanis at phil.uu.nl
Sun Feb 25 20:46:17 CET 2007
On Tue, 20 Feb 2007 00:17:53 +0100, Josiah Carlson <jcarlson at uci.edu>
wrote:
>
> "Jan Kanis" <jan.kanis at phil.uu.nl> wrote:
> [snip]
>> lst = []
>> for i in range(10):
>> lst.append(lambda i: i*i)
>
> You must mean something like...
> lambda j: i*j
yes. my mistake.
>> <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.
>
> - Josiah
On Tue, 20 Feb 2007 14:28:23 +0100, Nick Coghlan <ncoghlan at gmail.com>
wrote:
> Jan Kanis wrote:
> <mode=dreaming> I just hope if
>> python were designed today it would have done these. </mode>
>
> If Python had done these, it wouldn't be Python ;)
True. Let's make the better-than-python language. (aiming high) ;)
More information about the Python-ideas
mailing list