Home > Articles > Open Source > Python

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Migration Tools

As we've seen so far, the 3.x changes don't represent some wild mutation of the familiar Python syntax—just enough to break the old code base. Of course, these changes affect users, so a good transition plan is needed, with good tools or aids.

The 2to3 tool will take Python 2.x code and attempt to generate a working equivalent in Python 3.x. Here are some of the things it does:

  • Converts print statements to print() functions
  • Removes L long suffix
  • Replaces <> with !=
  • Changes backtick-quoted strings (`...`) to repr(...)

This tool does a lot of the manual labor, but not everything—the rest is up to you. You can read more about porting suggestions and the 2to3 tool in van Rossum's "What's New in Python 3.0" as well as in the 2to3 web page in the Python library.

  • + Share This
  • 🔖 Save To Your Account