+1 to Alan's point. Having different type behaviour depending on the values
of x and y for np.arange(x) ** y would be awful, and it would also be awful
to have to worry about overflow here...

...

Having said that, it would be equally annoying to not have a way to define
integer powers...


From: Alan Isaac <alan.is...@gmail.com> <alan.is...@gmail.com>
Reply: Discussion of Numerical Python <numpy-discussion@scipy.org>
<numpy-discussion@scipy.org>
Date: 10 June 2016 at 5:10:57 AM
To: Discussion of Numerical Python <numpy-discussion@scipy.org>
<numpy-discussion@scipy.org>
Subject:  Re: [Numpy-discussion] Integers to integer powers, let's make a
decision

On 6/10/2016 2:42 AM, Nathaniel Smith wrote:
>
> I dunno, with my user hat on I'd be incredibly surprised / confused /
> annoyed if an innocent-looking expression like
>
> np.arange(10) ** 2
>
> started returning floats... having exact ints is a really nice feature
> of Python/numpy as compared to R/Javascript, and while it's true that
> int64 can overflow, there are also large powers that can be more
> precisely represented as int64 than float.
>
>
>
> Is np.arange(10)**10 also "innocent looking" to a Python user?
>
> Also, I am confused by what "large powers" means in this context.
> Is 2**40 a "large power"?
>
> Finally, is np.arange(1,3)**-2 "innocent looking" to a Python user?
>
> Cheers,
> Alan
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to