[Numpy-discussion] What type should / return in python 3k when applied to two integer types?
Charles R Harris
Thu Aug 27 21:11:53 CDT 2009
On Thu, Aug 27, 2009 at 4:21 PM, Robert Kern <firstname.lastname@example.org> wrote:
> On Thu, Aug 27, 2009 at 15:13, Christopher Barker<Chris.Barker@noaa.gov>
> > Charles R Harris wrote:
> >> I also intend to make it work with
> >> from future import division
> > doesn't already?
> > In : from __future__ import division
> > In : 3 / 4
> > Out: 0.75
> > In : import numpy as np
> > In : np.array(3) / np.array(4)
> > Out: 0.75
> > In : np.array(3) // np.array(4)
> > Out: 0
> Yes, the support for that feature is already there.
> >> I've also considered making that import the default for numpy
> > I'd like that, but it is a bit radical --
> I don't think so. The policy just affects modules inside numpy, not
> users of numpy.
If we go to returning doubles we will have a backward compatibility problem
because the current floor_divide returns float32 for short ints. I see three
1) Leave true_divide as is.
2) Leave true_divide as is, introduce slash_divide that always returns
3) Change true_divide to always return doubles.
None of these options involve much more that a short edit of of the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion