Re:Toolz: A functional standard library for Python
by fwip on Thursday January 21, 2021 @03:28PM
(#25863779)
You can do multiple lines, just not multiple statements:
[ Parent
| on HN ]
Re:Toolz: A functional standard library for Python
by pansa2 on Thursday January 21, 2021 @03:37PM
(#25863911)
In fact, no statements at all - just a single expression.
Re:Toolz: A functional standard library for Python
by Iwan-Zotow on Friday January 22, 2021 @12:11AM
(#25868541)
well, you could pack a lot of other expressions into that expression, especially with 3.8/3.9, e.g.
x,y = 1,2
q = list(map(lambda t: (tx := t*x, ty := t*y, tx+ty)[-1], [1, 2, 3]))
Re:Toolz: A functional standard library for Python
by pansa2 on Friday January 22, 2021 @03:22AM
(#25869591)
Walrus operator: not even once.
Re:Toolz: A functional standard library for Python
by Iwan-Zotow on Saturday January 23, 2021 @12:34PM
(#25884293)
walrus, actually, being an expression, it's a perfect fit for lambdas