closures and dynamic binding
michele.simionato at gmail.com
Mon Sep 29 16:33:01 CEST 2008
On Sep 28, 6:43 am, "Aaron \"Castironpi\" Brady"
<castiro... at gmail.com> wrote:
> Hello all,
> To me, this is a somewhat unintuitive behavior. I want to discuss the
> parts of it I don't understand.
> >>> f= [ None ]* 10
> >>> for n in range( 10 ):
> ... f[ n ]= lambda: n
> ...>>> f()
> >>> f()
You may want to read this old thread that goes in detail explaining
with closures in for loops:
More information about the Python-list