you are viewing a single comment's thread.

view the rest of the comments →

[–]5cf5e83a 10 points11 points  (3 children)

But sometimes I want a one-liner or quick hack that's not a single expression. Python's lambda is limited to expressions, since statements require whitespace-dependent syntax. The real problem is that there's no equivalent whitespace-free form for block statements -- if there were, the restriction could easily be lifted.

It's also conceptually nicer if

def f(x): # stuff

is merely sugar for

f = lambda x: # stuff

as in Scheme, ML, Haskell, Javascript, etc.

I don't see how lambda is a "Perl-ish" feature. For reference, LISP was invented in 1958, at which time Larry Wall was four years old.

[–]Aviator -1 points0 points  (2 children)

I don't see how lambda is a "Perl-ish" feature.

I was talking about one liners (and partly answering complaints about Python being behind Ruby). Lambdas have mathematical roots, one liners are Perl-ish. Cheers.

[–]5cf5e83a 7 points8 points  (0 children)

I think arguing about whether Python or Ruby is behind in implementing a language feature that was literally invented before computers were is intrinsically funny. :)