[Numpy-discussion] Porting strategy for py3k
Thu Apr 23 18:29:30 CDT 2009
On Thu, Apr 23, 2009 at 15:39, Robert Kern <email@example.com> wrote:
> On Thu, Apr 23, 2009 at 09:52, David Cournapeau <firstname.lastname@example.org>
> > On Thu, Apr 23, 2009 at 11:20 PM, Pauli Virtanen <email@example.com> 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
> >>> 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.
-just my .02
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion