2 ms·
In fact, to perfectly mimic the HN experience, it should be plural = "s" if comments > 1 else "" "%d comment%s" % (comments, plural) if comments > 0 else "
by airstrike 6y ago
In fact, to perfectly mimic the HN experience, it should be
plural = "s" if comments > 1 else ""
"%d comment%s" % (comments, plural) if comments > 0 else "Discuss"
It feels really ugly doing this in Python, but oh well
I also miss seeing the clickable domain next to the submission's title rather than all the way down at the bottom
- the_pwner224 6y ago"Discuss" if comments == 0 else (f"{comments} comment" + "s"*(comments > 1))
- deleted 6y ago[deleted]
- airstrike 6y agoSure, I can put it all in one line too: "%d comment%s" % (comments, "s" if comments > 1 else "") if comments > 0 else "Discuss"