[SciPy-dev] about numpy.max() and numpy.min() - isn't it a bug?

Dmitrey Kroshko openopt@ukr....
Tue Aug 14 11:27:22 CDT 2007


          I use the min and max from numpy (from numpy import *)  
Ok, maybe they are same as python buildins  
But ordinary users usually use min and max, not amin and amax, so for to prevent the bug mentioned either they somehow should be warned, or the behavior of the numpy.min and max should be set to always produce numpy.array (for more safety).  
Also, I guess it's possible to contact python developers that wrote python min and max and ask them to yield numpy.array (when any of min/max args is numpy.array) instead of python type.  
  
Also, I think the behavior of the +/- operators (to yield python type) is not optimal.  
Suppose I have  
x = (4.4*t+myNumpyArr).tolist()  
So I should care does myNumpyArr is of size > 1 or not.  
Of course, there are funcs like atleast1d or something like that but users begin to use that ones only when some time have been elapsed to find and fix the bug. Same to amax/amin  vs max/min.  
  
//my 2 cents,  
D.  
  
Darren Dale wrote:      

On Tuesday 14 August 2007 11:41:51 am Dmitrey Kroshko wrote:
          

          Hi all,
as for me I think the behavior of the func is not optimal

                                    

from numpy import *
max(array(2.), 0)
                              

array(2.0)

                                    

max(array(-2.), 0)
                              

0
        


You are not using numpy's amax and amin, but the python builtins.

                            

import numpy
                      


                            

numpy.amin(numpy.array(-2.), 0)
                      

-2.0



    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20070814/7d7f1227/attachment.html 


More information about the Scipy-dev mailing list