[Python-Dev] Recommend accepting PEP 312 -- Simple Implicit Lambda

Skip Montanaro skip at pobox.com
Sun Jun 19 15:45:24 CEST 2005


    >> As I see it, a lambda is an anonymous function. An anonymous function
    >> is a function without a name. We already have a syntax for a
    >> function...  why not use it. ie:
    >> 
    >> f = filter(def (a): return a > 1, [1,2,3])

    Kay> You mix expressions with statements. 

You could remove the "return" and restrict the body of the def to an
expression: 

    f = filter(def (a): a > 1, [1,2,3])

That looks almost exactly like a lambda, but uses "def" and parenthesizes
the argument list. It seems to me that would remind people "this is a
function".

Skip


More information about the Python-Dev mailing list