[Zope-dev] Please, if you port to Python 3, port to 2&3

Jim Fulton jim at zope.com
Sat Apr 30 11:36:33 EDT 2011


If we decide to port zope.org-based projects to Python 3, please
please please, port them to Python 2&3 rather than relying on 2to3 (or
3to2).  That is, update the code to work with both Python 2 and Python
3.  Relying on 2to3 (or 3to2) is a headache for anyone who uses a
"develop" installation of a package. (It's also rather annoying for
someone installing a 2to3-based project in Python 3.)

I often use develop installs of packages when debugging
interactions among packages and it's not practical to use 2to3
in that situation, especially if there's a chance you'll need to make
changes and check them in.

I found 2to3 somewhat helpful in beginning the process of getting
buildout working with Python 3, but then worked the source into a form
that works with both Python versions. The code is uglier, but not as
ugly as incporating 2to3 in the development workflow.

The six module:

  http://pypi.python.org/pypi/six

should help a lot. I didn't use it in buildout, because I didn't want
to add a dependency.  I did reuse some ideas.

Oh, BTW, for those who haven't noticed, buildout ios now available for
Python 3:

  http://pypi.python.org/pypi/zc.buildout/2.0.0a1

which means there's one less excuse not to start thinking about Python
3 ports. :)

Jim

--
Jim Fulton
http://www.linkedin.com/in/jimfulton


More information about the Zope-Dev mailing list