Truth in Advertising

In this book’s conclusion—after we’ve had a chance to study Python in action—we will return to some of the bigger ideas introduced in this chapter. I want to point out up front, though, that my background is in computer science, not marketing. I plan to be brutally honest in this book, both about Python’s features and about its downsides. Despite the fact that Python is one of the most easy-to-use and flexible programming languages ever created, there are indeed some pitfalls, which we will not gloss over in this book.

Let’s start now. One of the first pitfalls you should know about, and a common remark made by Python newcomers, is this: Python makes it incredibly easy to quickly throw together a bad design. For some, it seems a genuine problem. Because developing programs in Python is so simple and fast compared with using traditional languages, it’s easy to get wrapped up in the act of programming itself and pay less attention to the problem you are really trying to solve. If you haven’t done any Python development yet, you’ll find that it is an incremental, interactive, and rapid experience that encourages experimentation.

In fact, Python can be downright seductive—so much so that you may need to consciously resist the temptation to quickly implement a program in Python that works, is loaded with features, and is arguably “cool,” but that leaves you as far from a maintainable implementation of your original conception as you were when you started. The natural delays built into compiled language development—fixing compiler error messages, linking libraries, and the like—aren’t there in Python to apply the brakes. In fact, it’s not uncommon for a Python program to run the first time you try it; there is much less syntax and there are far fewer procedures to get in your way.

This isn’t necessarily all bad, of course. In most cases, the early designs that you throw together fast are steppingstones to better designs that you later keep. That is the nature of prototyping, after all, and often the reality of programming under tight schedules. But you should be warned: even with a rapid development language such as Python, there is no substitute for brains—it’s always best to think before you start typing code. To date, at least, no computer programming language has managed to make “wetware” obsolete.

Get Programming Python, 3rd Edition 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.