[Python-Dev] Let's just keep lambda (original) (raw)

Jiwon Seo seojiwon at gmail.com
Tue Feb 7 09:34:39 CET 2006


On 2/6/06, Christopher Armstrong <radeex at gmail.com> wrote:

On 2/7/06, "Martin v. Löwis" <martin at v.loewis.de> wrote: > Brett Cannon wrote: > > But I know that everyone and their email client is against me on this > > one, so I am not going to really try to tear into this. But I do > > think that lambda needs a renaming. Speaking as someone who still > > forgets that Python's lambda is not the same as those found in > > functional languages > > Can you elaborate on that point? I feel that Python's lambda is exactly > the same as the one in Lisp. Sure, the Lisp lambda supports multiple > sequential expressions (the "progn" feature), but I understand that > this is just "an extension" (although one that has been around several > decades). > > Of course, Python's expressions are much more limited as Lisp's (where > you really can have macros and special forms in as the "expression" > in a lambda), but the lambda construct itself seems to be the very > same one.

If we phrase it somewhat differently, we can see that lambdas are different in Python and Lisp, in a very practical way. First: Everything in Lisp is an expression. There's no statement, in Lisp, that isn't also an expression. Lambdas in Lisp can contain arbitrary expressions; therefore you can put any language construct inside a lambda. In Python, you cannot put any language construct inside a lambda. Python's and Lisp's lambdas are effectively totally different. +1 on keeping Lambda, +1 on making it more useful.

After lambda being made more useful, can I hope that I will be able to use lambda with multiple statements? :) Lambdas in Lisp and Python are different, but in the usability perspective they don't need to differ too much.

-Jiwon



More information about the Python-Dev mailing list