[June 2013] I'm pleased to announce the release of the 5th Edition of the book Learning Python—the most comprehensive version of this classic and foundational Python language tutorial.
This new edition has been brought thoroughly up-to-date with Python 3.3 and 2.7, and expanded substantially to reflect current practice in the Python world. Like its previous editions, this book also applies to all other Python releases in common use today. Whether you're using 3.X, 2.X, or both, you'll find this new edition tailored to your current and future needs.
Among other language extensions, this edition incorporates Python 3.3's namespace packages and Windows launcher, as well as 2.7's adoption of 3.X features such as set and dictionary comprehensions. In addition, this version has grown more 2.X compatible, and has been augmented with enhanced coverage of tools such as super(), descriptors, the MRO, and metaclasses, which have grown more pervasive in today's Python code. See Previews below for more on content.
As always, this book is designed to be an in-depth introduction to the core Python language, and work much like a self-paced class on Python fundamentals. With quizzes, exercises, and solutions, its material embodies nearly two decades of live Python training experience.
Learning Python, 5th Edition is available in print, ebook, and online forms from all the usual places, including Amazon and O'Reilly. For purchase options and links, please see the Purchase pointers page. FAQ: there are no plans for a new edition, as noted below.
In brief, this edition's main parts reflect major language topics:
|Getting Started||An introduction to Python and ways to launch code|
|Types and Operations||In-depth coverage of Python's built-in objects|
|Statements and Syntax||Python's procedural statements' syntax and roles|
|Functions and Generators||Functions and functional programming tools|
|Modules and Packages||Modules, module packages, and related concepts|
|Classes and OOP||Comprehensive OOP coverage—from basic to advanced|
|Exceptions and Tools||Raising and catching exceptions, context managers, tools survey|
|Advanced Topics||Unicode, descriptors, properties, decorators, metaclasses, and more|
|Appendixes||Usage tips, Windows launcher, Python changes, exercise solutions|
For more details, check out the Preface excerpt, or the full Table of Contents in the O'Reilly sampler.
There are hundreds of examples in this text. Some are short code segments typed and run at the Python interactive prompt, and others are larger scripts or modules coded and run in files. Although typing code manually is an important part of the learning process, larger examples can also be run by fetching them here.
The following two books are designed to complement and augment Learning Python, forming a 3-book documentation set:
Note that there are no current plans to release the latter of these in 5th edition form, as it is already 3.X-based, is fully up-to-date today (as of Python 3.5), and deals more with libraries than language.
Packt Publishing released a book also titled "Learning Python" in December 2015. I have nothing to do with this other book, and it is in no way associated with my book. This other book seems very different from my two-decade work, but its title is a clear infringement of a trademark owned by my publisher.
Unfortunately, my publisher opted
to do nothing about the infringement, and instead confusingly sells the other book,
it instead of mine. Given the amount of time and resources spent on developing my book,
this seems a bizarre business model, and makes about as much sense as Apple advertising a
competitor's "iPad." As always, please use discretion when purchasing texts—even
on my own publisher's website!
There are currently no plans for a new edition of this book. As of June 2016, the 5th Edition is just 3 years old. It provides in-depth coverage of language and programming fundamentals that span all Python versions—past, present, and future—and remains fully relevant to all Python programmers and applications today. Moreover, because its content has chronicled two decades of Python's history, this classic text also provides context important for understanding Python's current state.
Given the constant change of Python's development, readers should expect
to supplement any learning resource with documentation on recent Python
releases. For more on new editions, see
For more on post-publication Python changes, see
The publisher migrated this edition to a new tools chain for its 14th printing, released in August 2016. No material was added or removed in this printing, but formatting differences in the new tools chain impacted this and later printings in two ways: the page count increased by roughly 40 pages (to 1640), and page number locations of specific content changed slightly. The latter of these has some consequences for errata page reports:
To address both of the last two points, any new errata reports will include page numbers for both newer and older printings. On the upside, the impact of this change is expected to be negligible, as most errata have already been caught and fixed at the 3-year point in this edition's history; thanks to all who took time to note the typos.