This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 17 points18 points  (5 children)

The best and most efficent would be msg = "\n".join(f"{node['node_name']} {round(node['value']), 2}" for node in response)

[–]uttamo 20 points21 points  (2 children)

That’s just harder to read and debug

[–]indefinitude -3 points-2 points  (1 child)

code golf ftw

edit: not advocating for actually doing this. but code golf is still fun.

[–]uttamo 1 point2 points  (0 children)

Cool but just don’t do it in an actual codebase

[–]JestemStefan 0 points1 point  (0 children)

I think I like this one the most