On 26/01/13 01:22, eryksun wrote:

With a function call you no longer need the default parameter hack
(i.e. x=i, y=j). You can make a closure over the local i and j in
buttonFunMaker:

     def buttonFunMaker(i, j):
         def func():
             return ttt(i, j)
         return func

Good catch!

     def buttonFunMaker(i, j):
         return lambda: ttt(i, j)

Since the point was to get away from lambda I discounted this option, but it was my first instinct! :-)

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to