3 ms·
The example given (I know it's synthetic, but still) can be written easily as a lambda: button.onClick(lambda bar, fram: baz(foo(bar, fram))) The problem wi
by jmillikin 17y ago
The example given (I know it's synthetic, but still) can be written easily as a lambda:
button.onClick(lambda bar, fram: baz(foo(bar, fram)))
The problem with embedding procedure definitions within parameter lists is indentation. Languages such as JavaScript or Ruby use explicit syntax for indentation, which allows a degree of flexibility in how procedure literals are defined. Python uses only whitespace, so trying to extend the grammar to support arbitrary procedure literals would be very difficult (according to Guido).
- mbreese 17y agoI kinda like the way syntax the parent used. It seemed to make sense and work with the whitespace.
- llimllib 17y agofor the same reasons of style and clarity, I prefer my imaginary syntax to the lambda you've defined. And if you want to make it impossible, just imagine it's "print baz(z)". Anyway, I'm familiar with why Guido doesn't want them, and I totally respect it, and I write 99% of my personal code in python, so I clearly don't think it's a huge deal. It's just something I wish python did have, is all.