The following conventions are used in this book:


Items in brackets are usually optional. The exceptions are those cases where brackets are part of Python’s syntax.


Something followed by an asterisk can be repeated zero or more times.

a | b

Items separated by a bar are often alternatives.


Used for filenames and URLs and to highlight new terms.

Constant width

Used for code, commands, and command-line options, and to indicate the names of modules, functions, attributes, variables, and methods.

Constant width italic

Used for replaceable parameter names in command syntax.

Get Python Pocket Reference, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.