[Numpy-discussion] Porting strategy for py3k

David Cournapeau cournape@gmail....
Thu Apr 23 08:38:21 CDT 2009


    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).



More information about the Numpy-discussion mailing list