Hacker News new | ask | show | jobs
by wenc 2701 days ago
I was responsible for the Python 2 to 3 migration for various code bases at work. I used 2to3 to check for issues, but did most of the code rewrites by hand.

Most of the conversion difficulties were related to Unicode/text/binary string handling in Python 3, and 2to3 didn't catch all of them. This was the biggest challenge of the entire process. Stuff would fail in production because due to improper string handling. Python 2 was remarkably permissive (i.e. loosy goosey), whereas Python 3 is stricter and arguably more correct, but this strictness has a cost.

The other class of problems is the restructure of certain std libs, like urllib. We took the opportunity to move away from "urllib" to "requests".

This site [1] was invaluable in understanding the migration issues.

All in all, apart from breaking Unicode issues, the migration process was fairly easy.

[1] http://python3porting.com/problems.html