[Tutor] Summing up the lambda discussion

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue, 27 Aug 2002 23:48:49 -0700


On Tuesday 27 August 2002 23:17, Scot W. Stevenson wrote:
> Hi there,
>
> If I understand the comments by the experts here, then the discussion o=
n
> lambda could be summed up as following:
>
> 1. Python only implements a primitive version of lambdas, robbing this =
tool
> of most of the power it has in other languages such as Scheme [which is=
 a
> variant of Lisp?]. Actually, they're kinda neat when done right, and it=
 is
> unfair to criticize them based on the Python implementation.
>

1 and 2 are actually the same argument ....  And yes, Scheme is basically=
 a=20
derivative of Lisp.

> 2. Our lambdas are further hamstrung by Python's distinction between
> statements and expressions, which isn't a feature of other, more
> lambda-friendly languages.
>
> 3. Any Python lambda can be replaced by a def statement, tho this requi=
res
> extra coding and creates a bound function.
>
> Now this sounds like _everybody_ is frustrated by Python's lambda funct=
ion:
> The experts because it is only a shadow of the lambdas in functional
> languages, and the newbies because it somewhat confusing at first in
> syntax and use.
>
> So the obvious question seems to be: Are there any plans to either beef=
 up
> lambda so it is as useful as in other languages, or to just implement t=
he
> Cheese Shop solution and get rid of it alltogether?
>

I like lambda and use it when it fits.  I still use map() and filter() mo=
re=20
than list comprehensions though.  LCs seem to be directly attacking the=20
lambda niche.  Guido has commented that lambda is one of the parts of pyt=
hon=20
he would reconsider.

At the moment I see lambda as a point of user style.  It is no longer a p=
iece=20
of python that you have to use.  Unless of course you find LCs as ugly as=
 I=20
do (-: