3 ms·
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., tr
by Balinares 3mo 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]