While Python’s version does feel a bit backwards, it’s at least consistent with how list comprehensions are set up (they can also feel a bit “backwards” imo)
Comment on proportional reaction
four@lemmy.zip 1 day agoWhat I like about using if
and else
for that is that you’re already using those keywords for branching in other parts of the code.
Though my least favorite is probably Python’s:
x = "foo" if y > 5 else "bar"
It just seems backwards to me
thebestaquaman@lemmy.world 1 day ago
four@lemmy.zip 1 day ago
List comprehension is another thing I don’t like about Python :)
There’s more of those, but one thing I do like about Python is that I get paid for writing it, so I try not to complain too much
kryptonianCodeMonkey@lemmy.world 1 day ago
I love list comprehension. Best part of the language, imo. To each their own.
UnfortunateShort@lemmy.world 1 day ago
Because Python wants you to read it like English: English:
x is “foo” if y is greater than 5, else it is “bar”