[Python-porting] A Python 2 *and* 3 success story

Michael Watkins python at mikewatkins.ca
Mon Dec 8 01:25:13 CET 2008


David Binger of the MEMS Nanotechnology Exchange (MNX) writes about their
experience migrating their public and private code base such that it can
run on either Python >= 2.4 or 3.x deployment targets:

    http://mail.mems-exchange.org/durusmail/qp/441/

I'm a user of the packages, not a developer, and have been using QP and
Durus since they first were born, and Quixote before that. I was happy to
see that the "compatibility shims" do not feel too ugly nor do they seem
to overly intrude on the code. There doesn't seem to be any downside for
*this* particular set of packages to support Python >= 2.4 (which includes
3.x) out of the same code base.

You find navigate down through the packages and end up at a "browse"
interface:

    http://www.mems-exchange.org/software/

I helped do testing of QP and related packages and through that experience
noted that of the various changes, probably the metaclass syntax change
had the potential for the ugliest 2-and-3 style workaround but in the end
there was a slightly more graceful solution staring me in the face that
works on both major Python versions:

    http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/






More information about the Python-porting mailing list