Python programmer, Django developer and SQL slayer. I have been programming for over 10 years; each one of those years has included a bug or 2.
Engineering manager and SRE for Envelop Risk
I cannot help but think the author has confused "clean code" with shortest code.
If anyone on my team wrote the "tenary example" I would give them a serious talking too. Why?
Code is generally written once and read many times. The focus should never be on the shortest code you can write but instead on the most readable code you can write. Even if that means the code is 20% longer than a shorter solution.
I cannot help but think the author has confused "clean code" with shortest code.
If anyone on my team wrote the "tenary example" I would give them a serious talking too. Why?
Code is generally written once and read many times. The focus should never be on the shortest code you can write but instead on the most readable code you can write. Even if that means the code is 20% longer than a shorter solution.
'Readable' is purely subjective - depends upon the "reading level" of the reader. That said, nested conditional operators are not great