Python 3

This is a short summary of the major changes between the Python 2.x versions and Python 3.0, the latest version. Not all changes to the language are mentioned here; more comprehensive information can be found at the official Python web site or the “What’s New in Python 3.0” page. Some of the information here has already been talked about previously in this book; it is mentioned here again for easier reference.

If you need to port Python 2.x code to version 3.0, there is a simple utility called “2to3” that will automatically correct and modify the legacy code to the new version. Generally speaking, you simply call the 2to3 program and let it run; it is robust enough to handle the vast majority of code changes necessary. However, the library is flexible enough to allow you to write your own “fixer” code if something doesn’t work correctly.