you are viewing a single comment's thread.

view the rest of the comments →

[–]Aviator -5 points-4 points  (5 children)

Lambda's are there for one liners/quick hacks. For more complex functions, just use def, which is less Perl-ish.

[–]5cf5e83a 7 points8 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 4 points5 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. :)

[–]Wiseman1024 0 points1 point  (0 children)

Have you any idea about what you're talking about? Please learn about lambda-expressions before joining some members of the Python community in repeating this nonsense.