>I have been reading though the PyGTK tutorial. > Can anyone explain how lambda is being used in this > statement: > > button.connect("clicked", lambda w: gtk.main_quit())
lambda is being used to create an anonymous function. The code could be rewritten like this: def f(w): gtk.main_quit() button.connect("clicked", f) lambda simply saves cluttering up the code with lots of tiny function derfinitions which are never referred to apart from in the binding operation. You can read about lambdas in the functional programming topic in my tutor HTH, Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor