2 ms·
I understand the preference and the difficulty created by methods and operators that are essentially statements instead of expressions. However, when making tha
by xapata 9y ago
I understand the preference and the difficulty created by methods and operators that are essentially statements instead of expressions. However, when making that criticism we should also acknowledge the benefit of requiring or encouraging multiple lines for those actions.
if (x=42) {}
Has burned many people. Append having a useful return is comparable, though probably not as much of a trap.
> sorted(data)[1:][0]
I don't want to get into the weeds, but shouldn't that just be
sorted(data)[1]
Or if you like unpacking for clarity
first, second = sorted(data)[:2]
?