Re: Problem understanding how closures work

2006-12-12 Thread Tom Plunket
Rob Williscroft wrote: > "name" in the above code is bound to a an entry in "CreateTests1"'s > locals, and ExCall has a (hidden) reference to that locals, so > by the time ExCall is finally called the value associated > with "name" has been replaced by (count - 1). Ah, I got it. Thanks. Than

Re: Problem understanding how closures work

2006-12-12 Thread Gabriel Genellina
On 12 dic, 17:23, Tom Plunket <[EMAIL PROTECTED]> wrote: > ...at least, I think that I'm having a problem understanding the way > closures work. > > I'm trying to define a function for an object which will take certain > objects from the parent scope at the time that function is defined. > def Cr

Re: Problem understanding how closures work

2006-12-12 Thread Rob Williscroft
Tom Plunket wrote in news:[EMAIL PROTECTED] in comp.lang.python: > ...at least, I think that I'm having a problem understanding the way > closures work. > > I'm trying to define a function for an object which will take certain > objects from the parent scope at the time that function is defined.

Problem understanding how closures work

2006-12-12 Thread Tom Plunket
...at least, I think that I'm having a problem understanding the way closures work. I'm trying to define a function for an object which will take certain objects from the parent scope at the time that function is defined. For some reason, if I do this function definition in a loop, the locals give