The Python community has come to use the adjective Pythonic to describe code that
follows a particular style. The idioms of Python have emerged over time through
experience using the language and working with others. This chapter covers the best way
to do the most common things in Python.
Chapter 2: Functions
Functions in Python have a variety of extra features that make a programmer’s life easier.
Some are similar to capabilities in other programming languages, but many are unique to
Python. This chapter covers how to use functions to clarify intention, promote reuse, and
Chapter 3: Classes and Inheritance
Python is an object-oriented language. Getting things done in Python often requires
writing new classes and defining how they interact through their interfaces and
hierarchies. This chapter covers how to use classes and inheritance to express your
intended behaviors with objects.
Chapter 4: Metaclasses and Attributes
Metaclasses and dynamic attributes are powerful Python features. However, they also
enable you to implement extremely bizarre and unexpected behaviors. This chapter covers
the common idioms for using these mechanisms to ensure that you follow the rule of least
Chapter 5: Concurrency and Parallelism
Python makes it easy to write concurrent programs that do many different things
seemingly at the same time. Python can also be used to do parallel work through system
calls, subprocesses, and C-extensions. This chapter covers how to best utilize Python in
these subtly different situations.
Chapter 6: Built-in Modules
Python is installed with many of the important modules that you’ll need to write programs.
These standard packages are so closely intertwined with idiomatic Python that they may as
well be part of the language specification. This chapter covers the essential built-in
Chapter 7: Collaboration
Collaborating on Python programs requires you to be deliberate about how you write your
code. Even if you’re working alone, you’ll want to understand how to use modules written
by others. This chapter covers the standard tools and best practices that enable people to
work together on Python programs.
Chapter 8: Production
Python has facilities for adapting to multiple deployment environments. It also has built-in
modules that aid in hardening your programs and making them bulletproof. This chapter
covers how to use Python to debug, optimize, and test your programs to maximize quality
and performance at runtime.