Re:Ask HN: What does Ruby have that Python doesn't?
by kaens on Saturday August 23, 2008 @02:38AM
(#284509)
A python "lambda expression" can effectively only be a one-liner - basically the return line of a function minus "return".
That is why people consider them castrated - in most languages I'm aware of that have a "lambda" statement, it can be read as "create an anonymous function that executes this body of statements". In python it reads as "perform a simple transformation or calculation on or with these arguments", as that's all it's generally good for.
Re:Ask HN: What does Ruby have that Python doesn't?
by brushbox on Friday August 22, 2008 @08:24PM
(#284360)
I think it is due to the statement/expression dichotomy that Python exhibits.
Python's lambda doesn't allow the use of statements (correct me if I'm wrong I haven't written Python in a few years and they may have "fixed" this).
Meanwhile Ruby only allows expressions too - the catch here is that everything in Ruby is an expression.
Re:Ask HN: What does Ruby have that Python doesn't?
by duane on Friday August 22, 2008 @10:22PM
(#284416)
A lambda is traditionally a functional programming product--think Lambda Calculus. Functional programming doesn't have statements, and neither should lambdas. Or do you mean anonymous function, in which case you're right.
Re:Ask HN: What does Ruby have that Python doesn't?
by staticshock on Friday August 22, 2008 @10:09PM
(#284405)
They don't plan to fix this, it's part of the core philosophy
Can you elaborate on why you think Python's lambda is castrated?