Writing Professional Python Code (Intro)
“Code is meant to be written for people.”
It’s the philosophy that has allowed Python to rise above the chaff and become recognized as the wheat. It’s currently the fastest growing in terms of popularity, and the 2nd most loved language, according to the 2019 StackOverflow Developer survey.
Why? Because Python can be elegant. It can be poetry, and yet practical. A child can read it. But only if it’s written well.
It’s rarely written well.
Get David Liu’s stories in your inbox
Join Medium for free to get updates from this writer.
We never learned in school how to actually write good code, no one explicitly told us. No one at work tells us exactly what we need to do either- they only point out when things are blatantly wrong or buggy with our code. But when a variable is ambiguous, or a docstring is missing, these problems are often overlooked and deprioritized.
Code without documentation is nearly worthless
What happens when we keep putting code-quality and testing on the backburner? We cultivate garbage code. No one can read it, it looks like convoluted spaghetti, and it’s littered with bugs or redundancies. When we look away from it for a week or more, and come back to it, it looks foreign.
If someone created a new machine to cure a disease, but it took 8 years just to learn how to use the technology, the technology needs minor changes every month, and needs large changes that take 2 years every 4 years, would you consider it useable?
“Move fast and break things” has become a colloquialism, and yet it contributes to wasteful cycles of throwaway code that end up being buggy and require “expert readers” simply to comprehend. Experts leave, and new team-members have to spend time learning where the bodies are buried. Many times, a complete overhaul or refactor is necessary, but doesn’t happen for a long time. Sometimes never.
Writing great code isn’t easy, but Python makes it much easier
Python’s minimalist syntax makes it so much easier to write good code than other languages out there. Frankly, the programming language doesn’t really matter- the principles still apply, but most people will agree that good Python code looks almost like art.
Writing great code involves everyday essential skills. It requires discipline, consistency, thoroughness, efficiency, and empathy- skills that are applicable to many aspects of our lives.




