Hi,

Robert Bradshaw wrote:
> This is in fact very much in line with how closures would be 
> implemented--there would be an extension class that would hold the state 
> (and garbage collection would happen when this object went out of scope, 
> so no issues for generators or closures).

Just coming up with a couple of corner cases to make sure they will work in
this solution. Could you comment on how they are handled?

1)

def f():
    x = 1
    def a(): print x
    def b(): print x
    return (a,b)

2)

for i in range(10):
    def a(): print i
    a()

(outputs 0-9 in Python)

3)

for i in range(10):
    if i == 0:
        def a(): print i
    a()

(outputs 0-9 in Python)

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to