[Numpy-discussion] Old tickets

Christopher Barker Chris.Barker@noaa....
Thu Mar 31 11:04:13 CDT 2011


On 3/31/11 8:41 AM, Benjamin Root wrote:
>     The ticket is about the functions np.divide and np.power, not / and
>     **. This currently does not work the same, unlike what's said above:

> Hmm, I didn't notice that distinction.  So long as there is a consistent
> difference between the function and the operator, I am fine with that.

>     >  whether we want
>     >  np.power to behave differently from ** (if they are internally handled
>     >  separately at all)...

Please, no! the operator and functions should behave the same. I 
certainly always expect them to. For instance, I often write code with 
operators, then replace that with the functions so that i can add an 
"out" parameter for performance reasons -- I would be very surprised if 
the function were defined differently -- it would be a source of 
surprising bugs.

> So, in this case, the ** operator and np.power are identical, but
> diverges from the behavior of python's operator.

I think consistency within numpy is more important that consistency with 
python -- I expect differences like this from python (long integers, 
different data types, etc)

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list