O'Reilly logo

Beautiful Testing by Adam Goucher, Tim Riley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 that Python has both. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required