[Numpy-discussion] Porting strategy for py3k

Ryan May rmay31 at gmail.com
Thu Apr 23 11:30:19 EDT 2009


On Thu, Apr 23, 2009 at 9:52 AM, David Cournapeau <cournape at gmail.com>wrote:

> On Thu, Apr 23, 2009 at 11:20 PM, Pauli Virtanen <pav at iki.fi> 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.
>

I think the point is that you can just change it to print("yoyo") which will
work in both python 2.x and 3.x.  The parenthesis are just extraneous in
python 2.x. Now, the more complicated uses of print won't be as easy to
change, but I'm not sure how prevalent their use is.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090423/8cc757b9/attachment.html>


More information about the NumPy-Discussion mailing list