On Thu, Apr 23, 2009 at 15:39, Robert Kern <[email protected]> wrote:
> On Thu, Apr 23, 2009 at 09:52, David Cournapeau <[email protected]> > wrote: > > On Thu, Apr 23, 2009 at 11:20 PM, Pauli Virtanen <[email protected]> wrote: > >> 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") > > > > Yes, as reduce, they are still available, but not as builtins anymore. > > But replacing print is not as easy as reduce. Things like print > > "yoyo", a do not work, for example. > > Doesn't the 2to3 tool do this conversion for you? It does for Print at least. conditional compiling for C would work. I could see extending it to the python code as well. I don't know how feasible this is, but have a script that runs at installation and cuts out blocks of code that aren't compatible with the version it's being installed on. for example, run the script on a file like below, and keep only what is useable by the version installed. import foo ###py2x.begin import py2xbar.py ###py2x.end ###py3k.begin import py3kbar.py ###py3k.end -just my .02 -Ross > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless > enigma that is made terrible by our own mad attempt to interpret it as > though it had an underlying truth." > -- Umberto Eco > _______________________________________________ > Numpy-discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ Numpy-discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
