Re:Toolz: A functional standard library for Python
by omaranto on Friday January 22, 2021 @02:31AM
(#25869357)
Plenty of languages with significant-whitespace have multiline anonymous functions, like Haskell, Standard ML, Ocaml, etc. Maybe it's no possible in Python for a student reason, but the reason is not that the syntax is bad on indentation.
Re:Toolz: A functional standard library for Python
by pansa2 on Friday January 22, 2021 @03:16AM
(#25869569)
The syntaxes of those languages are fundamentally different from Python’s. They don’t have an “expressions may not contain statements” rule - they don’t even have statements.
Re:Toolz: A functional standard library for Python
by omaranto on Friday January 22, 2021 @05:54AM
(#25870524)
It sounds like you agree with me: the reason Python does not have multiline lambdas is not that it has significant-whitespace, but other decisions including the “expressions may not contain statements” rule.
There’s no good way to add support for full anonymous functions to Python’s grammar. One of the rules that makes significant-whitespace work elegantly is that statements can contain expressions, but never vice-versa.