Comment by Balinares
5 days ago
Mainly I disliked the walrus operator because Python already has a keyword that means "capture the output of this clause into this variable": as.
E.g.,
try:
with open("file.txt") as f:
do_something(f)
except OSError as e:
print(e)
And now:
L = [abs(x) as x_abs for x in some_list if x_abs < 10]
No comments yet
Contribute on Hacker News ↗