My new ebook “Comprehending Comprehensions” is on pre-sale and 40% off!

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 hope you learned something new! If you did, consider following the footsteps of the readers who bought me a slice of pizza 🍕. Your small contribution helps me produce this content for free and without spamming you with annoying ads.

Previous Post Next Post

Blog Comments powered by Disqus.