I really don't understand Lambda!

Ian Bicking ianb at colorstudy.com
Thu Oct 10 20:23:21 EDT 2002


On Thu, 2002-10-10 at 18:49, Bob van der Poel wrote:
> Just when I thought I was understanding lambda, it totally confuses me.
> I have the following statement in my program, which works:
> 
> 	wg.bind("<Return>", lambda s=wg: seq.setSize(wg) )

I think you want:

wg.bind("<Return>", lambda e, s=wg: seq.setSize(s))

The callback is always called with the event as the one argument (even
if you don't care about the event).

  Ian






More information about the Python-list mailing list