2 Introduction
efficient, and scalable to the needs of whatever cloud computing applica-
tion its users require. When you have a project of this size, things like test-
ing and documentation absolutely require automation, or else they won’t
get done at all.
I thought I knew a lot about Python before working on projects of this
scale—a scale I could hardly imagine when I started out—but I’ve learned
a lot more. I’ve also had the opportunity to meet some of the best Python
hackers in the industry and learn from them. They’ve taught me everything
from general architecture and design principles to various helpful tips and
tricks. Through this book, I hope to share the most important things I’ve
learned so that you can build better Python programs—and build them
more efficiently, too!
The first version of this book, The Hacker’s Guide to Python, came out
in 2014. Now Serious Python is the fourth edition, with updated and entirely
new contents. I hope you enjoy it!
Who Should Read This Book and Why
This book is intended for Python coders and developers who want to take
their Python skills to the next level.
In it, you’ll find methods and advice that will help you get the most
out of Python and build future-proof programs. If you’re already working
on a project, you’ll be able to apply the techniques discussed right away to
improve your current code. If you’re starting your first project, you’ll be
able to create a blueprint with the best practice.
I’ll introduce you to some Python internals to give you a better under-
standing of how to write efficient code. You will gain a greater insight into
the inner workings of the language that will help you understand problems
or inefficiencies.
The book also provides applicable battle-tested solutions to problems
such as testing, porting, and scaling Python code, applications, and libraries.
This will help you avoid making the mistakes that others have made and dis-
cover strategies that will help you maintain your software in the long run.
About This Book
This book is not necessarily designed to be read from front to back. You
should feel free to skip to sections that interest you or are relevant to your
work. Throughout the book, you’ll find a wide range of advice and practical
tips. Here’s a quick breakdown of what each chapter contains.
Chapter 1 provides guidance about what to consider before you under-
take a project, with advice on structuring your project, numbering versions,
setting up automated error checking, and more. At the end there’s an inter-
view with Joshua Harlow.
Chapter 2 introduces Python modules, libraries, and frameworks and
talks a little about how they work under the hood. You’ll find guidance on