
July 3, 2006
1:36 a.m.
Giovanni Bajo wrote:
I believe that names in lambdas/nested-functions referring to local names in the outer scope should really be bound at function definition time
No, you don't want that, because it would make functions that call each other very awkward to arrange.
And it's also handy that the iteration variable of the for loop is accessible after the for loop is terminated (in fact, this specific behaviour is already listed among the wont-change for Py3k).
I'd just like to point out that the create-a-new-cell behaviour that I have proposed for loop variables *preserves* this ability! for new i in range(10): ... print i will still print 9. -- Greg