3 ms·
Is that intended as a defense of Python's ability to enable clear, concise, expressive code? :) More seriously: Yes, you are obviously correct. But while yo
by Lazare 10y ago
Is that intended as a defense of Python's ability to enable clear, concise, expressive code? :)
More seriously: Yes, you are obviously correct. But while you can use if/else, you can't use a ternary, and you can in Ruby. That's why people complain about the lack in Python but don't wrote the same article about Ruby.
- luord 10y ago"Clear, concise, expressive code" isn't something that applies to ternary operators. They were always meant as shortcuts and, as such, will never be as clear as if else statements, practically by design. Though I don't really dislike Python's approach so what do I know.
- jolux 10y agoYou can definitely use too many ternary operators, but I think when used sparingly they can be clear and tasteful. As long as you don't start nesting them or repeating them one after the other you should be fine.