[Python-Dev] 2.7 Release? 2.7 == last of the 2.x line? (original) (raw)

Daniel Stutzbach daniel at stutzbachenterprises.com
Tue Nov 3 15:14:46 CET 2009


On Tue, Nov 3, 2009 at 3:55 AM, David Cournapeau <cournape at gmail.com> wrote:

- are two branches are necessary or not ? If two branches are necessary, I think we simply do not have the resources at the moment. - how to maintain a compatible C API across 2.x and 3.x - is it practically possible to support and maintain numpy from 2.4 to 3.x ? For example, I don't think the python 2.6 py3k warnings are very useful when you need to maintain compatibility with 2.4 and 2.5.

I've already ported some of my Python extension modules to Python 3. Here's how I would answer your questions based on my experience.

Writing C code that compiles with Python 2.4 through 3.1 is pretty easy. Python's C API hasn't changed much and you can use #ifdef and #define for any bits that must be version-specific.

It's pretty easy to make Python source that works under 2.6 and 3.x. It's basically impossible to make Python source that works under 2.4/2.5 and 3.x. You may be able to write code that works under 2.4/2.5 and works cleanly with 2to3 to produce 3.x code. I haven't tried that route, though in theory it should work. All you really need is syntax compatibility. For the rest, you can check sys.version_info.

In a nutshell, I don't think you need two branches to support an extension module on Python 2 and Python 3.

YMMV.

-- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20091103/d4485062/attachment.htm>



More information about the Python-Dev mailing list