4 ms·
It is simply a design choice, the common value is given first. Comprehensions in Py are the same.
by mixmastamyk 5y ago
It is simply a design choice, the common value is given first. Comprehensions in Py are the same.
- Zababa 5y agoSure it's a design choice but, quoting the Zen of Python: > Special cases aren't special enough to break the rules. > There should be one-- and preferably only one --obvious way to do it. Both are broken by the existance of 2 if syntaxes depending on the context.
- DonHopkins 5y agoBut when you write "condition ? first : second" or "(if condition first second)", the first common value is still given before the second uncommon value, so what's the advantage of putting the condition BETWEEN first and second, instead of BEFORE? After all, the condition has to be EVALUATED first before deciding which one to use. Infix "if" conditions just scramble up the order of evaluation from the order of program source code.
- mixmastamyk 5y agoThe argument is that the most common value should be first and the rest can be thought of as rare and almost ignored. I don’t always agree, but still prefer it to C syntax which I have to look up every time.