[Numpy-discussion] Deprecate np.max/np.min ?

Neil Crighton neilcrighton@gmail....
Sat Nov 7 12:27:22 CST 2009


Charles R Harris <charlesr.harris <at> gmail.com> writes:

> People import these functions -- yes, they shouldn't do that -- and the python
builtin versions are overloaded, causing hard to locate errors.

While I would love less duplication in the numpy namespace, I don't think the 
small gain here is worth the pain of deprecation. 

> OTOH, one can ask, why is
> 
> 	np.min(3, 2)
> 
> allowed when
> 
> 	np.min([3], 2)
> 
> gives "ValueError: axis(=2) out of bounds". It seems to me that
> 0-dimensional objects should accept only None as the axis? (Fixing this
> would also make misuse of np.min and np.max more difficult.)

I think it would be better to fix this issue.  np.min(3,2) should also give
"ValueError: axis(=2) out of bounds". Fixing this also removes any possibility
of generating hard-to-find errors by overwriting the builtin min/max. (Unless
there's some corner case I'm missing).

Neil



More information about the NumPy-Discussion mailing list