Re: Securing a future for anonymous functions in Python

From: Terry Reedy (tjreedy_at_udel.edu)
Date: 01/07/05


To: python-list@python.org
Date: Thu, 6 Jan 2005 22:30:42 -0500


"Alan Gauld" <alan.gauld@btinternet.com> wrote in message
news:f1frt0dvi9tt37roe91gm96sg734opn07s@4ax.com...
> On Thu, 30 Dec 2004 23:28:46 +1000, Nick Coghlan
> <ncoghlan@iinet.net.au> wrote:
>
>> GvR has commented that he want to get rid of the lambda keyword for
>> Python 3.0.
>> Getting rid of lambda seems like a worthy goal,
>
> Can I ask what the objection to lambda is?
> 1) Is it the syntax?
> 2) Is it the limitation to a single expression?
> 3) Is it the word itself?

Depending on the person, any of the 3. Plus add
4) The constant complaints re: 2)

> I can sympathise with 1 and 2 but the 3rd seems strange since a
> lambda is a well defined name for an anonymous function used in
> several programming languages and originating in lambda calculus
> in math.

And that is why 'lambda' is wrong -- in Python, it is only an abbreviation
for a restricted group of def statements, which is *not* its 'well defined'
usage. Hence complaints re 2. If the syntax were def x: x + 2, etc, I
suspect the complaints would be far fewer.

For some new programmers, 'lambda' is as meaningless as elle*. All other
Python keywords are English words or obvious abbreviations thereof.

> So why not retain the name lambda but extend or change the syntax
> to make it more capable rather than invent a wholly new syntax
> for lambdas?

That you suggest this illustrates, to me, what is wrong with the name ;-)

Terry J. Reedy

* The Spanish name for the letter 'll', pronounced el-yea, which comes
after 'l' in their alphabet.



Relevant Pages

  • Re: default value in __init__
    ... It has nothing to do with lambda, lambda just happens to be a ...     print cb ... that newbies ask about these semantics doesn't imply that they'd ask ... But that's easy to do with current Python: ...
    (comp.lang.python)
  • Re: Python becoming less Lisp-like
    ... > Basically, it says that it will get rid of the explicit map, filter ... > It will also get rid of lambda, and it's not a great loss, since ... > The real problem with Python is that it has been very successful as a ...
    (comp.lang.python)
  • Re: Python becoming less Lisp-like
    ... > Basically, it says that it will get rid of the explicit map, filter ... > It will also get rid of lambda, and it's not a great loss, since ... > The real problem with Python is that it has been very successful as a ...
    (comp.lang.lisp)
  • Re: I sing the praises of lambda, my friend and savior!
    ... I think that Ruby's code block syntax offers a workable ... How about extending lambda? ... >I actually discovered lambdas in Python first (well, technically Tcl, but I ...
    (comp.lang.python)
  • Re: Python becoming less Lisp-like
    ... >Basically, it says that it will get rid of the explicit map, filter ... >It will also get rid of lambda, and it's not a great loss, since ... For a while it covered some Python ...
    (comp.lang.python)