[Numpy-discussion] What type should / return in python 3k when applied to two integer types?
Robert Kern
robert.kern@gmail....
Thu Aug 27 17:21:34 CDT 2009
On Thu, Aug 27, 2009 at 15:13, Christopher Barker<Chris.Barker@noaa.gov> wrote:
> Charles R Harris wrote:
>> I also intend to make it work with
>>
>> from future import division
>
> doesn't already?
>
> In [3]: from __future__ import division
>
> In [5]: 3 / 4
> Out[5]: 0.75
>
> In [6]: import numpy as np
>
> In [7]: np.array(3) / np.array(4)
> Out[7]: 0.75
>
> In [8]: np.array(3) // np.array(4)
> Out[8]: 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.
--
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
More information about the NumPy-Discussion
mailing list