3 ms·
OTOH, I would love Python even more if I could do: x = function(x) return x*x end and not use those awful Python lambdas... Not that it really matters th
by sebcat 8y ago
OTOH, I would love Python even more if I could do:
x = function(x) return x*x end
and not use those awful Python lambdas...
Not that it really matters though, bridges still get built.
- aldanor 8y agoYour example is already doable without lambdas: def f(x): return x * x
- sebcat 8y agoTo clarify: the point I was trying to make was that the explicit 'end' in Lua allows for closures that are more nice (subjective) than Python lambdas. Something both JS and Lua got right, but with which Python ended up with a much more limited syntax.
- klibertp 8y agoThe lambda syntax is not what makes it less nice - it's the fact that they are limited to a single expression. Being indentation-based has nothing to do with that restriction: Nim manages to use indents and to have multiline lambdas at the same time.
- enriquto 8y agoit looks a bit perverse to use the same name for the function and for its argument, but maybe it's just me
- sebcat 8y agoLexical scope, I like it
- doc_gunthrop 8y agox = lambda x: x*x It doesn't look that bad in comparison...