
On Tue, 20 Feb 2007 00:17:53 +0100, Josiah Carlson <jcarlson@uci.edu> wrote:
"Jan Kanis" <jan.kanis@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@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) ;)