[PYTHON MATRIX-SIG] Re: max/min bug

Konrad Hinsen hinsen@ibs.ibs.fr
Tue, 28 Jan 1997 11:26:44 +0100


> Anyway, here are my attempts: 
> (If there are mistakes, please shout loud!)
> 
> def max(m,axis=0):
>       if axis == None:
>    return maximum.reduce(ravel(m))
>       else:
>    return maximum.reduce(m,axis)
> 
> def min(m,axis=0):
>       if axis == None:
>    return minimum.reduce(ravel(m))
>       else:
>    return minimum.reduce(m,axis)

The definitions are OK (and probably quite useful), but I would
strongly recommend *not* to redefine min and max, which after all are
built-in Python functions. If you import these definitions plus some
code that needs the built-ins, you will get nasty surprises.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

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