HN user

nandoflorestan

1 karma

Python developer and classical musician.

Posts0
Comments1
View on HN
No posts found.

Hmm. I still see many people griping about Python 3 incompatibility, so here is my comment.

If you have some code that you would like to have working under Python 3, check out a little library called "six". With it, it is simple to maintain a single codebase that works with both Python versions (no translations necessary, forget the 2to3 tool).

For example, the Pyramid web framework (and many related libraries) have been successfully using this approach. This way one can support Python 2.6, 2.7 and 3.2+.

Together with "from future" imports (for Python 2.6 and 2.7), this is easy to understand, though "upgrading" the code may still take time.

At the top of every module of mine I have this:

from __future__ import (absolute_import, division, print_function, unicode_literals)