Opinion
Readability beats clever one-liners — every time
Dense one-liners feel impressive but cost the next reader. A short case for boring, obvious code.
June 2026 · 5 min read · 2 views · 0 hearts
Python rewards expressive code, which tempts us to cram logic into a single clever line. The problem is that code is read far more often than it is written.
The hidden cost
A nested comprehension with two conditions and a ternary saves three lines today and costs ten minutes of squinting next month — usually by someone who is not you.
A simple test
If you would need a comment to explain a one-liner, that is a signal to expand it into named steps instead. The names become the explanation.
Clever has its place in tight inner loops. For everything else, optimize for the reader. Boring code is a feature.
Sponsored
Comments
Questions, corrections, and tips stay visible for everyone reading this page.
Join the discussion
No comments yet
Be the first to leave a note — it helps the next reader.