[Python-Dev] Let's just *keep* lambda
Brett Cannon
brett at python.org
Wed Feb 8 19:58:46 CET 2006
On 2/8/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> 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.
>
I agree with Phillip. Making it look more like a function definition,
I think, is a bad move to make. The thing is quirky as-is, let's not
partially mask that fact.
> 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. :)
>
``(use x, y, in x**y)`` is the best I can think of off the top of my
head. But if Guido is not budging on tweaking lambda in any way other
than parentheses, then I say just leave the busted thing as it is and
let it be the wart that was never removed.
-Brett
More information about the Python-Dev
mailing list