[Numpy-discussion] Output type of round is inconsistent with python built-in

Robert Kern robert.kern at gmail.com
Wed Feb 26 16:36:31 EST 2020


On Wed, Feb 26, 2020 at 3:19 PM Hameer Abbasi <einstein.edison at gmail.com>
wrote:

>
> There still remains the question, do we return Python ints or np.int64s?
>
>    - Python ints have the advantage of not overflowing.
>    - If we decide to add __round__ to arrays in the future, Python ints
>    may become inconsistent with our design, as such a method will return an
>    int64 array.
>
>
>
> This was issue was discussed in the weekly triage meeting today, and the
> following plan of action was proposed:
>
>    - change scalar floats to return integers for __round__ (which integer
>    type was not discussed, I propose np.int64)
>    - not change anything else: not 0d arrays and not other numpy
>    functionality
>
> The only reason that float.__round__() was allowed to change to returning
ints was because ints became unbounded. If we also change to returning an
integer type, it should be a Python int.

-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200226/fd7b36d0/attachment-0001.html>


More information about the NumPy-Discussion mailing list