Oops, I screwed up!
On Sat, Jan 30, 2016 at 02:31:09PM +1100, Steven D'Aprano wrote: > Complicated? Well, a bit. Here's a simpler demonstration of a closure: > > > def factory(num): > """Factory function that returns a new function that adds > num to whatever it is given.""" > def adder(x): > return x + num Of course that can't work, because I forgot to return the inner function. def factory(num): def adder(x): return x + num return adder will work better. Sorry for any confusion. -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor