[Numpy-discussion] Proposal to make power return float, and other such things.

Sturla Molden sturla.molden at gmail.com
Tue Feb 18 06:19:54 EST 2014


Robert Kern <robert.kern at gmail.com> wrote:

> That's fine if you only have one value for each operand. When you have
> multiple values for each operand, say an exponent array containing
> both positive and negative integers, that becomes a problem.

I don't really see why. If you have a negative integer in there you get a
float array returned, otherwise it stays integer.

> Generally, we try to make ufuncs return types that are predictable
> from the types of the operands, not the values of the operands.

Isn't that unpractical in this case? Who cares if the power operator
behaves as an ufunc?

Sturla




More information about the NumPy-Discussion mailing list