A critic of Guido's blog on Python's lambda

Alex Martelli aleaxit at yahoo.com
Sun May 7 14:57:59 EDT 2006


<brian at sweetapp.com> wrote:

> Patrick May wrote:
> > aleaxit at yahoo.com (Alex Martelli) writes:
> >> In my opinion (and that of several others), the best way for Python to
> >> grow in this regard would be to _lose_ lambda altogether, since named
> >> functions are preferable
> >
> >      Why?  I find the ability to create unnamed functions on the fly
> > to be a significant benefit when coding in Common Lisp.
> 
> 1. They don't add anything new to the language semantically i.e. you
>    can always used a named function to accomplish the same task
>    as an unnamed one.
> 2. Giving a function a name acts as documentation (and a named
>    function is more likely to be explicitly documented than an unnamed
>    one). This argument is pragmatic rather than theoretical.
> 3. It adds another construction to the language. 

Creating *FUNCTIONS* on the fly is a very significant benefit, nobody on
the thread is disputing this, and nobody ever wanted to take that
feature away from Python -- it's the obsessive focus on the functions
needing to be *unnamed* ones, that's basically all the debate.  I wonder
whether all debaters on the "unnamed is a MUST" side fully realize that
a Python's def statement creates a function on the fly, just as much as
a lambda form does.  Or maybe the debate is really about the distinction
between statement and expression: Python does choose to draw that
distinction, and while one could certainly argue that a language might
be better without it, the distinction is deep enough that nothing really
interesting (IMHO) is to be gleaned by the debate, except perhaps as
pointers for designers of future languages (and there are enough
programming languages that I personally see designing yet more of them
as one of the least important tasks facing the programming community;-).


Alex



More information about the Python-list mailing list