
June 13, 2011
10:37 p.m.
Nick Coghlan wrote:
-lots on any idea that would make:
def f(): i = 0 def g1(): return i i = 1 def g2(): return i return [g1, g2]
differ in external behaviour from:
def f(): result = [] for i in range(2): def g(): return i result.append(g) return result
One possible variation of my idea wouldn't change the existing behaviour of the for-loop at all, but would require you to explicitly request new-binding behaviour, using something like for new i in range(2): def g(): return i -- Greg