re: We don't need a ternary operator VIEW POST


Look at cond ? true_value : false_value. Is there anything that makes it look like three arguments are involved?

This is exactly why I like Python's ternary operator:

true_value if cond else false_value

The use of English words instead of cryptic symbols reduces the ambiguity.


Python's ordering is backwards. IT breaks the standard if-then logic and chooses then-if wording. I really dislike the Python way of handling this.


That's interesting, I tend to think about conditionals the same way it is in Python, ie "do this thing if something is true otherwise do this other thing", rather than "if something is true do this thing otherwise do this other thing".

It's interesting how different people think differently. :)

code of conduct - report abuse