> > Both the responses offer lambda free alternatives. That's fine, and > given the terse documentation and problems that I had understanding > them, I would agree. So what applications are lambdas suited to? I > think the parameterised function model is one. > What else?
i've hardly ever used lambdas since map() and filter() were replaced by list comprehension. two other uses I can think of for it are: using it as a sorting key (which takes a function and lambdas are perfect for that when a direct function isn't available. for example, lambda x: x.myName), and I made an irc bot once that certain events had a list of fuctions that would be called after that event. it was like being able to dynamically add and remove event handlers. for example what if you asked the user a question and you wanted to know for the next input whether it was from that user and was an answer to that question. sometimes the function to add would be very simple, so writing a def for it would just be ugly. -- http://mail.python.org/mailman/listinfo/python-list