Re:Guido was right, there should be no lambda in Python (2018)
by kazinator on Wednesday September 28, 2022 @03:13AM
(#33005088)
It could work like this:
The lambda bodies immediately follow the line. If the line has arguments, those follow the lambdas:
[ Parent
| on HN ]
Re:Guido was right, there should be no lambda in Python (2018)
by kazinator on Wednesday September 28, 2022 @01:00PM
(#33010305)
The def keyword followed by a colon could be used as the marker for the continuation material that supplies the multi-line lambada bodies.
Perhaps the double colon would be unnecessary: just make the expression optional, and if it's missing then there has to be an "outboard" body.
if foo(lambda x:, list) < bar(lambda y:, list):
def: # lambda x
return x + x
def: # lambda y
return 2 * y
return list # then statement of if