by gilch · 5y ago · 0 comments
Did you mean to say that lambda expressions can't contain statements? But no Python expressions can! But functional programming is all done with expressions anyway, to the point where functional languages don't even have statements, so what's the problem?
>>> (lambda a, b=2:
... print(a, a, b, b, c:=3, c, *[[d,d] for d in [4]][0])
... )(1)
1 1 2 2 3 3 4 4
That's four different ways to get locals with no statements.