|
|
|
|
|
by o_pax
2606 days ago
|
|
Python has its version of the ternary operator as well. It may look unusual due to the different order of the operands, but it works quite nicely, in my opinion: x = (-1 if a < b else
1 if a > b else
0)
This emphasizes the possible values that x may be assigned to. |
|