Re: Is this a closure?

2008-08-31 Thread John Machin
On Sep 1, 9:53 am, ssecorp <[EMAIL PROTECTED]> wrote: > A method on a class: > > def printSelf(self): > def printReviews(): > for review in self.reviews: > review.printSelf() > print "Idnbr: ", self.idnumber, "Reviews: ", printReviews() > The above appea

Re: Is this a closure?

2008-08-31 Thread Chris Rebert
Yes, printReviews() is a closure. In particular, it's closing over the variable "self", which it's getting lexically from printSelf(). - Chris On Sun, Aug 31, 2008 at 4:53 PM, ssecorp <[EMAIL PROTECTED]> wrote: > A method on a class: > > def printSelf(self): >def printReviews(): >

Is this a closure?

2008-08-31 Thread ssecorp
A method on a class: def printSelf(self): def printReviews(): for review in self.reviews: review.printSelf() print "Idnbr: ", self.idnumber, "Reviews: ", printReviews() I don't have to pass an argument to printReviews because everything defined inside p