Odd closure issue for generators

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Jun 5 03:31:23 EDT 2009


In message 
<78180b4c-68b2-4a0c-8594-50fb1ea2f414 at c19g2000yqc.googlegroups.com>, Michele 
Simionato wrote:

> The crux is in the behavior of the for loop:
> in Python there is a single scope and the loop variable is
> *mutated* at each iteration, whereas in Scheme (or Haskell or any
> other functional language) a new scope is generated at each
> iteration and there is actually a new loop variable at each iteration:
> no mutation is involved.

I think it's a bad design decision to have the loop index be a variable that 
can be assigned to in the loop.




More information about the Python-list mailing list