Chris Mellon <[EMAIL PROTECTED]> writes: > As someone who does a tremendous amount of event-driven GUI > programming, I'd like to take a moment to speak out against people > using us as a testament to the virtues of lamda. Event handlers are > the most important part of event-driven code, and making them real > functions with real names is crucial to maintainable code. The only > reason to ever use a lamdba in Python is because you don't want to > give a function a name, and that is just not a compelling use case for > GUI events.
I thought stuff like the following was idiomatic in GUI programming. Do you really want separate names for all those callbacks? # generate calculator keypad buttons Button(label='7', command=lambda: user_pressed(7)).grid(column=1, row=1) Button(label='8', command=lambda: user_pressed(8)).grid(column=2, row=1) Button(label='9', command=lambda: user_pressed(9)).grid(column=3, row=1) Button(label='4', command=lambda: user_pressed(4)).grid(column=1, row=2) Button(label='5', command=lambda: user_pressed(5)).grid(column=2, row=2) Button(label='6', command=lambda: user_pressed(6)).grid(column=3, row=2) ... -- http://mail.python.org/mailman/listinfo/python-list