[Python-Dev] Let's just *keep* lambda
Phillip J. Eby
pje at telecommunity.com
Wed Feb 8 19:16:16 CET 2006
At 10:07 AM 2/8/2006 -0800, Guido van Rossum wrote:
>On 2/8/06, Patrick Collison <patrick at collison.ie> wrote:
> > And to think that people thought that keeping "lambda", but changing
> > the name, would avoid all the heated discussion... :-)
>
>Note that I'm not participating in any attempts to "improve" lambda.
>
>Just about the only improvement I'd like to see is to add parentheses
>around the arguments, so you'd write lambda(x, y): x**y instead of
>lambda x, y: x**y.
lambda(x,y) looks like a function call until you hit the ':'; we don't
usually have keywords that work that way.
How about (lambda x,y: x**y)? It seems like all the recently added
constructs (conditionals, yield expressions, generator expressions) take on
this rather lisp-y look. :)
Or, if you wanted to eliminate the "lambda" keyword, then "(from x,y return
x**y)" could be a "function expression", and it looks even more like most
of the recently-added expression constructs.
Well, actually, I guess to mirror the style of conditionals and genexps
more closely, it would have to be something like "(return x**y from x,y)"
or "(x**y from x,y)".
Ugh. Never mind, let's just leave it the way it is today. :)
More information about the Python-Dev
mailing list