[Python-3000] lambda

Nick Coghlan ncoghlan at gmail.com
Wed Mar 26 10:21:02 CET 2008


Lennart Regebro wrote:
> On Tue, Mar 25, 2008 at 9:42 PM, Olivier Verdier <zelbier at gmail.com> wrote:
>> repeats over and over again: lambda is just synctactic sugar for a function
>> definition. Here are suggestion for a new name for lambda, which will much
>> better describe what it is, namely a *function*.
> 
> More specifically, an anonymous function.  Best would be if you could
> just use def anonymously. And preferrably use normal return syntax:
> 
>    def(a,b): return a+b
> 
> instead of
> 
>    lambda a, b: a+b
> 
> would actually make it readable enough that I might start using it. ;)

Some might say that the ugliness of the current syntax is a point in its 
favour ;)

The code will almost always become more readable and self-documenting if 
the function is given a name.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list