[Numpy-discussion] Integers to negative integer powers, time for a decision.

Krisztián Horváth raksi.raksi at gmail.com
Sat Oct 8 15:31:56 EDT 2016


Hello,

I think it should be consistent with Python3. So, it should give back a
float.

Best regards,
Krisztian

On Sat, Oct 8, 2016 at 3:12 AM, Charles R Harris <charlesr.harris at gmail.com>
wrote:

> Hi All,
>
> The time for NumPy 1.12.0 approaches and I like to have a final decision
> on the treatment of integers to negative integer powers with the `**`
> operator. The two alternatives looked to be
>
>
> *Raise an error for arrays and numpy scalars, including 1 and -1 to
> negative powers.*
> *Pluses*
>
>    - Backward compatible
>    - Allows common powers to be integer, e.g., arange(3)**2
>    - Consistent with inplace operators
>    - Fixes current wrong behavior.
>    - Preserves type
>
>
> *Minuses*
>
>    - Integer overflow
>    - Computational inconvenience
>    - Inconsistent with Python integers
>
>
> *Always return a float *
>
> *Pluses*
>
>    - Computational convenience
>
>
> *Minuses*
>
>    - Loss of type
>    - Possible backward incompatibilities
>    - Not applicable to inplace operators
>
>
>
> Thoughts?
>
> Chuck
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20161008/2992e746/attachment.html>


More information about the NumPy-Discussion mailing list