Chapter 9. Beautiful Is Better Than Ugly

Neal Norwitz

Michelle Levesque

Jeffrey Yasskin

Note

“Beautiful is better than ugly” is the first line of The Zen of Python.[17] The Zen captures the guiding principles of the Python community, both in developing the language and creating beautiful applications with it.

Imagine that you’re writing a piece of code and hit a strange bug. You spend all day trying to isolate what could be going wrong, only to discover that you didn’t make a mistake. Your code works perfectly. In fact, the problem isn’t with your code at all; the problem is a bug in the compiler or interpreter that you’re using. Yuck! It wouldn’t take many days like this before you abandoned this flaky programming language in favor of something more stable. Stability in the programming languages we use is something that most of us take for granted, but it doesn’t just happen automagically. The Python interpreter is made up of code just like any other piece of software, and it is equally vulnerable to mistakes and bugs. So how do you keep the programming language stable enough that these types of problems don’t happen? Moreover, how do you ensure correctness in an organic environment where the language will inevitably grow and change? Where patches will come from people you don’t know who could be living anywhere on the globe? This task would be nearly impossible without the help of a comprehensive set of tests and a strong testing philosophy, so it’s no wonder ...

Get Beautiful Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.