3 ms·
It definitely is a technical issue: Python simply doesn't support multiline expressions. Anything utilizing an indent block must be a statement by the nature o
by bascule 12y ago
It definitely is a technical issue: Python simply doesn't support multiline expressions.
Anything utilizing an indent block must be a statement by the nature of the Python grammar, and since lambdas pretty much require returning a value (the new lambda) to be useful (and are thus expressions), they cannot be modeled as statements in Python, and therefore can't utilize indent blocks.
This is definitely an oddity of the Python grammar, where statements vs. expressions are entangled into how Python models indent blocks. Statements can contain expressions but expressions cannot contain statements.
Compare to Haskell, an everything-is-an-expression language which still supports indent sensitivity and multiline lambdas.
Guido just chose a wacky way to implement an indent-sensitive grammar.