Chapter 26. v3.7 to v3.n Migration
This book spans several versions of Python and covers some substantial (and still evolving!) new features, including:
-
Order-preserving dicts
-
Type annotations
-
:= assignment expressions (informally called “the walrus operator”)
-
Structural pattern matching
Individual developers may be able to install each new Python version as it is released, and solve compatibility issues as they go. But for Python developers working in a corporate environment or maintaining a shared library, migrating from one version to the next involves deliberation and planning.
This chapter deals with the changing shape of the Python language, as seen from a Python programmer’s viewpoint. (There have been many changes in Python internals as well, including to the Python C API, but those are beyond the scope of this chapter: for details, see the “What’s New in Python 3.n” sections of each release’s online documentation.)
Significant Changes in Python Through 3.11
Most releases have a handful of significant new features and improvements that characterize that release, and it is useful to have these in mind as high-level reasons for targeting a particular release. Table 26-1 details only major new features and breaking changes in versions 3.6–3.111 that are likely to affect many Python programs; see the Appendix for a more complete list.
Version | New features | Breaking changes |
---|---|---|
3.6 |
|
Get Python in a Nutshell, 4th 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.