<div class="gmail_quote">On Tue, Nov 3, 2009 at 3:55 AM, David Cournapeau <span dir="ltr">&lt;<a href="mailto:cournape@gmail.com">cournape@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

 - are two branches are necessary or not ? If two branches are<br>
necessary, I think we simply do not have the resources at the moment.<br>
 - how to maintain a compatible C API across 2.x and 3.x<br>
 - is it practically possible to support and maintain numpy from 2.4<br>
to 3.x ? For example, I don&#39;t think the python 2.6 py3k warnings are<br>
very useful when you need to maintain compatibility with 2.4 and 2.5.<br></blockquote></div><br>I&#39;ve already ported some of my Python extension modules to Python 3.  Here&#39;s how I would answer your questions based on my experience.<br>
<br>Writing C code that compiles with Python 2.4 through 3.1 is pretty easy.  Python&#39;s C API hasn&#39;t changed much and you can use #ifdef and #define for any bits that must be version-specific.<br><br>It&#39;s pretty easy to make Python source that works under 2.6 and 3.x.  It&#39;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&#39;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.<br>
<br>In a nutshell, I don&#39;t think you need two branches to support an extension module on Python 2 and Python 3.<br><br>YMMV.<br><blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>