Porting to Python 3: An in-depth guide

Porting to Python 3: An in-depth guide

“Porting to Python 3: An in-depth guide” is available online for free. This book guides you through the process of porting your Python 2 code to Python 3, from choosing a porting strategy to solving your distribution issues.


So when should you port? In general, I would recommend everyone to move to Python 3 as soon as you can. If the applications and modules you write are for your or your company’s use only, then look into porting when it feels like you have the time. If your project is in a state of panic, moving to Python 3 is probably not the right thing to do.

If you are writing software that you sell or share as open source, then you want to move more quickly to enable your customers to move over to Python 3.

If you are writing a package that other developers use, every day it doesn’t support Python 3 is a day when you are blocking your users from porting, and a day when Python 3 users have to look for another package than yours. In this case you should really try to port immediately.

Table of Contents

  • Welcome to Python 3
  • Migration strategies
  • Preparing for Python 3
  • Porting with 2to3
  • Common migration problems
  • Improving your code with modern idioms
  • Supporting Python 2 and 3 without 2to3 conversion
  • Migrating C extensions
  • Extending 2to3 with your own fixers
  • Language differences and workarounds
  • Reorganizations and renamings

Book Details

Author(s): Lennart Regebro
Publisher: CreateSpace
Format(s): HTML(Online)
File size: –
Number of pages: 212
Link: Read online.

Leave a Reply