On 5/17/07, Anne Archibald <[EMAIL PROTECTED]> wrote:

Hi,

Numpy has a max() function. It takes an array, and possibly some extra
arguments (axis and default). Unfortunately, this means that

>>> numpy.max(-1.3,2,7)
-1.3

This can lead to surprising bugs in code that either explicitly
expects it to behave like python's max() or implicitly expects that by
doing "from numpy import max".

I don't have a *suggestion*, exactly, for how to deal with this;
checking the type of the axis argument, or even its value, when the
first argument is a scalar, will still let some bugs slip through
(e.g., max(-1,0)). But I've been bitten by this a few times even once
I noticed it.

Is there anything reasonable to do about this, beyond conditioning
oneself to use amax?


I don't know what a good fix is, but I got bitten by that one the other day
too.

--bb
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to