[Python-3000] lambda

Olivier Verdier zelbier at gmail.com
Thu Mar 27 16:22:41 CET 2008


On 26/03/2008, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> I think if I come across a keyword I didn't know in a language I was
> learning, I'd look it up to find out what it means.


Yes but it doesn't look like a keyword, does it? It looks like a letter of
the greek alphabet to me. :-) The first time I came across lambda I looked
for the definition of the variable "lambda" in the whole program and
wondered about that strange syntax: "variable x,y: x+y".

Lambda calculus is a
> well established field of mathematics, so it's a perfectly valid name
> for the construct.
>

In my university in Sweden lambda calculus is never taught neither in pure
nor applied math. It is only a part of a course in computer science applied
to linguistics. The word "lambda" however is  used all over the place as an
eigenvalue, or a wave length, or parameter, or Lamé coefficient in many of
our courses.


So don't use it. Use a named function instead. Then it will be even more
> of a pleasure to read, because the name you choose will tell the reader
> what the function is for. You can even attach a docstring to make it
> really obvious.


I don't use lambda. I never ever use it. But people use it. I am talking
about beginners in front of a code where lambda is used. I am also talking
about a beginner writing "lambda = 3." and getting a weird syntax error
message.


> I thought that the upcoming of python 3000 would be a good opportunity
> > to change this name but since few or no python beginners or newcommers
> > are reading this mailing list I don't think that I will get a lot of
> > support here. :-)
>
>
> For a long time, lambda functionality wasn't going to exist in Py3k at
> all. It certainly isn't going to get enough care and attention to
> warrant Guido expending the mental energy needed to arbitrarily choose a
> new name, and anyone else going through the code and docs changing it.
>
> Python beginners and newcomers should be steered completely clear of
> anonymous functions anyway.



They can't. lambda is used all over the place. I'm teaching python for
scientific computing and I don't teach lambda but I have to tell students
never to use the name "lambda" as a variable.

I also agree with the idea that the lambda construct should rather use a
keyword free syntax like "x -> 3*x" or something of that kind. That would be
gorgeous.

Sorry if I posted this in the wrong mailing list. I was not aware of the
python-ideas mailing list but you will sure get messages from me over there
as well. :-)

Thanks for all the responses.

== Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080327/79b94cbc/attachment.htm 


More information about the Python-3000 mailing list