[Numpy-discussion] Porting strategy for py3k

Bruce Southey bsouthey@gmail....
Thu Apr 23 09:21:03 CDT 2009

David Cournapeau wrote:
> Hi,
>     I looked more in detail on what would be needed to port numpy to
> py3k. In particular, I was interested at the possible strategies to
> keep one single codebase for both python 2.x and python 3.x. The first
> step is to remove all py3k warnings reported by python 2.6. A couple
> of recurrent problems
>     - reduce is removed in py3k
>     - print is removed
>     - some exceptions constructions are not allowed
> I think a first step would be to add a compatibility module to remove
> any use of print/reduce in the numpy codebase (should not be too
> difficult). For reduce, we could import functools from python code
> (functools is not available in python 2.4). Unless someone has an
> objection, I will import functools code, make it compile for python
> 2.4 and above, and remove all builtin reduce calls in numpy.
> Another problem is related to nose: there is an experimental branch
> for nose which supports py3k, but nose <= 1.0 will not support py3k.
> The nose author intend to support py3k in a version > 1.0, at which
> point he will only support python 2.6 and above. I don't know what to
> do with this (include our own nose in numpy for version < 2.6 - giving
> up support for python < 2.6 does not sound like a realistic option in
> the next few years).
> cheers,
> David
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
It is good news that nose has some Py3K support. Hopefully all NumPy 
tests will work with all versions of nose as Python 2.6 is meant to be 
backwards compatible.

I agree that a single code base should be used if possible however there 
are a lot of C code changes required as well as Python code changes:

Are the C code changes independent of the warnings provided by Python 
2.6 -3 option and eventually the 2to3 tool?


More information about the Numpy-discussion mailing list