[Numpy-discussion] Porting strategy for py3k

Pauli Virtanen pav at iki.fi
Thu Apr 23 10:20:19 EDT 2009


Thu, 23 Apr 2009 22:38:21 +0900, David Cournapeau kirjoitti:
[clip]
>     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

Print is not removed, just changed to a function. So,

	print("foo")

is valid code in 2.X and 3.0. OTOH, I don't think there are any valid use 
cases for "print" in Numpy code anyway (maybe apart from tests).

>     - some exceptions constructions are not allowed

Some more:

    - xrange is no more
    - dict.iteritems / dict.iterkeys / etc are no more

etc. 

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

Can't we just assume Python 2.6 and 3.0 users have the appropriate 
versions of Nose installed? Or is the old Nose version going to disappear?

This would limit our responsibility to just ensuring that our Nose 
extensions work with all relevant Nose versions.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list