3 ms·
What's so monstrous about it? It's practically English: cssClass = 'selected' if isCurrentTab else 'deselected'
by QuadrupleA 5y ago
What's so monstrous about it? It's practically English:
cssClass = 'selected' if isCurrentTab else 'deselected'
- a-nikolaev 5y agoProbably b/c Python abuses the same keywords way too much. (But that shouldn't be such a surprise already to oppose this particular case.)
- Cthulhu_ 5y agoYou have a weird perception of English. "If the tab is selected, the CSS class is 'selected', else it's deselected. Or in pseudocode if isCurrentTab cssClass = 'selected' else cssClass = 'deselected' Even ternaries read weird. "css class is current tab HUH?? selected COLON! deselected"
- chrismorgan 5y ago“Set css class to ‘selected’ if it’s the current tab, or else ‘deselected’.”
- QuadrupleA 5y agoBoth read grammatically fine to me. If you prefer to do things in 4 lines rather than one, and repeat the variable, that's up to you I guess - a lot of people seem to agree - but honestly I don't get what the fuss is about.