Re: [Python-Dev] Closures / Python Scopes

2010-11-12 Thread Terry Reedy
On 11/12/2010 3:08 PM, Hatem Nassrat wrote: A colleague of mine came across something anecdotal when working with lambdas, it is expressed by the following code snippet. In [1]: def a(): ...: for i in range(10): ...: def b(): ...: return i ...:

[Python-Dev] Closures / Python Scopes

2010-11-12 Thread Hatem Nassrat
A colleague of mine came across something anecdotal when working with lambdas, it is expressed by the following code snippet. In [1]: def a(): ...: for i in range(10): ...: def b(): ...: return i ...: yield b ...: ...: In [2]: func