by c22 · 7y ago · 0 comments
if a < b: x = -1
else if a > b: x = 1
else: x = 0
Which a lot of people seem to hate for some reason, but I always appreciated the compromise between terseness and clarity. x = (-1 if a < b else
1 if a > b else
0)
This emphasizes the possible values that x may be assigned to.