7 ms·
Compared to C's ternary operator [1] it seems the Python version operates on 5 items. [1] https://en.m.wikipedia.org/wiki/Ternary_operation https://en.m.wikipe
by dcassett 8y ago
Compared to C's ternary operator [1] it seems the Python version operates on 5 items.
[1] https://en.m.wikipedia.org/wiki/Ternary_operation https://en.m.wikipedia.org/wiki/Ternary_operation
- underwater 8y agoIsn't it just two nested ternary operators? The equivalent being: selected_value = condition_1 ? value_1 : condition_2 ? value_2 : value_3