3 ms·
> with the caveat of needing to have it all in a single expression (the same goes for lambda, actually). one could use multiple expressions in lambda in (moder
by Iwan-Zotow 4y ago
> with the caveat of needing to have it all in a single expression (the same goes for lambda, actually).
one could use multiple expressions in lambda in (modern) Python
- vgel 4y agoDo you mean using the walrus operator? Because unless I missed a recent PEP, I don't know of a way to do this without something hacky like that.
- Iwan-Zotow 4y agoyes x = 1 y = 2 q = list(map(lambda t: ( tx := tx, ty := ty, tx+ty )[-1], [1, 2, 3])) print(q)