Supporting Python 3 (Python 3 supported)
About the book
Order
Welcome to Python 3
Migration policy
Only Python 3 is supported
Separate branches for Python 2 and Python 3
Convert to Python using 2to3 3
No conversion support for Python 2 and Python 3
Using 3to2
What kind of strategy is right for you?
Conclusion
Preparing for Python 3
Comparatively tricky
Implementing __HASH__ ()
Run under Python 2.7.
Use//instead of/when dividing integers
Use New-style classes
Separate binary data and strings
When sorting, use key instead of CMP
Use rich comparison operators
Make sure aren ' t using any removed modules
Testing coverage and Tox
Optional:use the Iterator-methods on dictionaries
2to3
Running Tests with Distribute
Running 2to3 with Distribute
Running 2to3 on Install
Explicit Fixers
Using 2to3
Distributing packages
Supporting multiple versions of Python with distribute
Common Migration Problems
Write () has a return value
Types is now classes
Handling expected exceptions
String representation
Dict and set Order
Byte literals
Binary data in Python 2 and Python 3
Nicer Solutions
Manipulating binary data
Reading from files
Incorrect imports
Relative Import Problems
Unorderable types, __cmp__ and CMP
Sorting
Sorting Unicode
Bytes, Strings and Unicode
Replacing UserDict
CSV API Changes
Running doctests
Improving your code with modern idioms
Abstract base Classes
Multiprocessing and Futures
Numbers and fractions
Use sorted () instead of. Sort ()
Coding with context Managers
Advanced string Formatting
Class Decorators
Set literals
Yield to the generators
More comprehensions
The next Next ()
New Modules
Supporting Python 2 and 3 without 2TO3 conversion
Supporting the print () function
Handling Exceptions
Import errors
Integer incompatibilities
More bytes, strings and Unicode
The Times three is "six"
Migrating C Extensions
Before you start
Object initialization
Module initialization
Changes in Python
Strings and Unicode
Extending 2to3 with your own fixers
Language Differences and workarounds
Reorganizations and Renamings
Supporting Python 3 (Python 3 supported)--Directory