Hacker News new | ask | show | jobs
by throwwaway8529 1200 days ago
Python can’t even do multi line lambdas
1 comments

sure it can
it's been a while since i used python; have lambdas improved? i recall weird restrictions using them, but i can't quite remember what. this was pre puthon 3
Assignment Expression were added, so you could do

x = 1 y = 2

q = list(map(lambda t: ( tx := tx, ty := ty, tx+ty )[-1], [1, 2, 3]))

print(q)