Securing a future for anonymous functions in Python

Doug Holton a at b.c
Thu Jan 6 22:02:46 EST 2005


Alan Gauld 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?
> 
> 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. Lambda therefore seems like a pefectly good name to
> choose.

I agree with keeping lambda functionality, and I don't care what name is 
used, but there are people who do not like "lambda":
http://lambda-the-ultimate.org/node/view/419#comment-3069
The word "lambda" is meaningless to most people.  Of course so is "def", 
which might be why Guido van Robot changed it to "define": 
http://gvr.sourceforge.net/screen_shots/

Even a simple word like "type" can be difficult to explain to beginners:
http://lambda-the-ultimate.org/node/view/337

Python is easier for beginners to learn than other mainstream 
programming languages (like java or C++), but that's not to say it 
doesn't have some stumbling blocks for beginners of course: 
http://www.linuxjournal.com/article/5028

> 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?

Yes, I agree, and either keep the "lambda" keyword or else reuse the 
"def" keyword for anonymous methods.  See this page Steven Bethard 
created: http://www.python.org/moin/AlternateLambdaSyntax

I really don't think anyone should worry about lambda disappearing.

By the way, you've done great work with your learning to program site 
and all the help you've given on the python-tutor list:

> Alan G.
> Author of the Learn to Program website
> http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Python-list mailing list