[PYTHON MATRIX-SIG] max/min bug?

Jim Crotinger jac@gandalf.llnl.gov
Tue, 28 Jan 1997 07:58:40 -0800


Konrad Hinsen writes:
 > Short answer: use minimum.reduce(a) and maximum.reduce(a) to get what you
 > expect.
 > 
 > Long answer: min() and max() are built-in Python functions that predate
 > NumPy. If they are called with a single argument which is a sequence
 > (e.g. an array), they return the smallest/largest element of that
 > sequence. Sounds fine, but isn't: what is the smallest of three arrays?
 > 

  That's what I thought.  This violates the principle of least
astonishment and really ought to be reconsidered somehow. Either it
should do what everyone (or at least most people) expects (which is to
return the largest/smallest element of the multidimensional array),
or it should throw an exception and complain.

  Jim

-- 
-------------------------------------------------------------------------------
James A. Crotinger |Magnetic Fusion Energy Theory/Computations| I speak for me
crotinger@llnl.gov |Lawrence Livermore National Laboratory    |The lab does not
(510) 422-0259     |P.O. Box 808, L-630; Livermore CA 94550   | And vice versa

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________