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

Stephan Hoyer shoyer at gmail.com
Sun Oct 9 14:59:10 EDT 2016


On Sun, Oct 9, 2016 at 6:25 AM, Sebastian Berg <sebastian at sipsolutions.net>
wrote:

> For what its worth, I still feel it is probably the only real option to
> go with error, changing to float may have weird effects. Which does not
> mean it is impossible, I admit, though I would like some data on how
> downstream would handle it. Also would we need an int power? The fpower
> seems more straight forward/common pattern.
> If errors turned out annoying in some cases, a seterr might be
> plausible too (as well as a deprecation).
>

I agree with Sebastian and Nathaniel. I don't think we can deviating from
the existing behavior (int ** int -> int) without breaking lots of existing
code, and if we did, yes, we would need a new integer power function.

I think it's better to preserve the existing behavior when it gives
sensible results, and error when it doesn't. Adding another function
float_power for the case that is currently broken seems like the right way
to go.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20161009/c1e00fe8/attachment.html>


More information about the NumPy-Discussion mailing list