3 ms·
Tk developers have long agreed with you, because it really is easier to say Button(frame, text="abc", command=lambda: self.highlight("abc")) than
by dalke 11y ago
Tk developers have long agreed with you, because it really is easier to say
Button(frame, text="abc",
command=lambda: self.highlight("abc"))
than to make a function for each command.
The loose consensus in Python is that lambdas are best when they fit on a line, which is what the examples at http://www.mccarroll.net/blog/pyspark2/index.html http://www.mccarroll.net/blog/pyspark2/index.html do. Otherwise, make a named function.
I think arguments like this are one of the main reasons why van Rossum has kept lambda in the language.