What does the Zen of Python 🐍 mean by “Beautiful is better than ugly”?
The Zen of Python 🐍 says
“Beautiful is better than ugly”
I take this to mean that aesthetics do matter, as they matter in everything else.
So, if your code is elegant, it is more likely to be good code.
>>> import this
Beautiful is better than ugly.
Striving to write elegant code might seem weird, but it's not!
A similar thing is done in maths:
There are many theorems that can be proven in many different ways, but mathematicians always try to find the most elegant proof.
One mathematician even took that to an extreme.
Paul Erdös, a prolific mathematician of the 20th century, often talked about “The Book”:
a book where the most elegant proofs for mathematical theorems had been written by a divinity.
When he'd find a beautiful proof, he would say “This one is from The Book!”.
So, aesthetics matter in fashion, design, marketing, etc...
But they also matter in mathematics and programming, and don't let anyone tell you otherwise!
Do you feel the same? 👇🗨️
This thread ties in nicely with the Pydon't about the Zen of Python, where I go over the point of the Zen of Python as a whole.
I write about Python every week. Join +16.000 others who are taking their Python 🐍 skills to the next level 🚀, one email at a time.