"Jason Zheng" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Steven Bethard wrote: >> Jason Zheng wrote: >> >>> I'm wondering why python still has limited lambda support. What's >>> stopping the developers of python to support more lisp-like lambda >>> function?
They already have: given the fundamental syntax difference between all expressions and expressions within statements, def statements are at least the equivalent of lisp lambdas + name binding. When you get an exception traceback, a unique name is more helpful than the pseudoname <lambda>. Isolating the definition of a function in a separate statement also makes it possible to unittest the function. >> This comes up every few weeks on the list. If you haven't already, >> check the archives in Google for 'anonymous def' or 'anonymous >> function'. The usual response to this question is something along the >> lines of "if it's good enough to create a function for, it's good enough >> to name". What puzzles me is 1) why some people apparently think anonymity is good -- is it really that hard to name non-trivial functions? and 2) why some people are so quick to recommend changes to Python before they understand what they can already do (wth def statements, in this case). > The true beauty of lambda function is not the convenience of creating > functions without naming them. Lambda constructs truly enables > higher-order function. And so do Python def statements coupled with Python design principles. In Python at least, the beauty of first-class functions has nothing to do with 'lambda'. > For example, I can create a function A that returns a function B that > does something interesting according to the arguments that I pass to > function A. Golly gee. Pythoneers have done this with def for at least a decade, if not from the very beginning. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list