[Python-Dev] Let's just *keep* lambda
Brett Cannon
brett at python.org
Tue Feb 7 22:43:15 CET 2006
More information about the Python-Dev mailing list
Tue Feb 7 22:43:15 CET 2006
- Previous message: [Python-Dev] Let's just *keep* lambda
- Next message: [Python-Dev] Let's just *keep* lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. > Chris is exactly right in what I meant. Lisp-like language do not have the statement/expression dichotomy. For instance, function definitions are syntactic sugar for defining a lambda expression that is bound to a name. This only works in Python if the function body is a single expression which is not the entire language. For Lisp, though, that can be anything allowed in the language, so the abilities are different. -Brett
- Previous message: [Python-Dev] Let's just *keep* lambda
- Next message: [Python-Dev] Let's just *keep* lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list