Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

For a complete reference and advise, see https://docs.python.org/3/howto/pyporting.html


It is possible to write code that works for both major versions of Python, and it is the recommended strategy for maximum compatibility and flexibility. See the following page for a comprehensive list of compatible idioms. The easiest way to make sure your python 2 code can run on python 3 is to use automatic conversion tools such as futurize. Even if they are not perfect in all cases, they should take care of adapting the vast majority of your code base without too many bugs introduced. Futurize will also generate code that is compatible with both editions. See the following page for a the quick start guide for instructions on how to use this tool.

https://python-future.org/quickstart.html

Writing Python 2/3 compatible code

...

.

...