r/PythonLearning • • Jul 04 '26

Unpopular Python opinion: Readable code is more important than clever code

I've seen one-line solutions that are technically impressive but take longer to understand than 10 lines of simple code.

Would you rather write more lines that anyone can understand, or fewer lines that look clever?

42 Upvotes

34 comments sorted by

View all comments

43

u/cgoldberg Jul 04 '26

That's not an unpopular opinion, and is generally shared among all programmers in all languages.

5

u/mati-33 Jul 04 '26

I would say its shared among mid and senior programmers and not so much among juniors

5

u/Overall-Screen-752 Jul 04 '26

No. The poor quality of junior code (an over-generalization and oversimplification, but ignored for sake of discussion) is due to deficient skill in the area of generating good, clean, maintainable code — which comes with time and practice working in codebases that possess good, clean and maintainable code or working with engineers who know how to write it (non-exhaustive list).

What op is talking about is not a deficiency in skill but rather a misused skill directed at optimizing for the wrong thing. It takes great skill to write the “golf” code that OP is talking about. It just takes wisdom to realize it should never be written in a production codebase.

1

u/llynglas Jul 05 '26

This, anyone who does not value readable over clever is just not experienced enough.