[Python-porting] Best practices for porting to Python 3

Andrew McNabb amcnabb at mcnabbs.org
Fri Mar 12 23:22:44 CET 2010

I recently ported some code to Python 3.  Overall, it was a very
positive experience.  My biggest problem was trying to find information
about best practices.  There's a lot of disorganized advice out there,
and it was clear to me that many people are confused about what to do.
If anything, porting to Python 3 was much easier than I expected based
on what I read.

Having gone through this experience, I decided to share what I learned
by adding information to the PortingPythonToPy3k page on the Python


The wiki page is still woefully incomplete, but I'm hoping to at least
encourage contributions so that the page can improve.

One of my main goals in updating the page is to make it clear that there
is more than one way to do it.  Everyone seems to have their favorite
approach, and this can turn into a surprisingly emotional issue.  Thus,
I have tried to split the page by approach so that people can add
information to the approach they prefer rather than trying to tear down

My hope is that consolidating advice on a single page, it might be
helpful for those who are intimidated by the process.  I would certainly
be disappointed if it turned into a dogmatic argument ("Using 2to3 is
the only way to do it!" or "Making code run unmodified is the only way
to do it!").

Would anyone on the python-porting page be willing to share their
experience by adding to the page?

Andrew McNabb
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868

More information about the Python-porting mailing list