[Numpy-discussion] numarray.sum should raise exception for wrong axis argument

Sebastian Haase haase at msg.ucsf.edu
Mon Jun 14 16:03:02 CDT 2004


Hi,
please take a look at this:
>>> na.sum( na.zeros((2,6)) )
[0 0 0 0 0 0]
>>> na.sum( na.zeros((2,6)) , 0)
[0 0 0 0 0 0]
>>> na.sum( na.zeros((2,6)) , 1)
[0 0]
>>> na.sum( na.zeros((2,6)) , 2)
[0 0]
>>> na.sum( na.zeros((2,6)) , 3)
[0 0]
>>> na.sum( na.zeros((2,6)) , 4)
[0 0]
>>> na.sum( na.zeros((2,6)) , -1)
[0 0]
>>> na.sum( na.zeros((2,6)) , -2)
[0 0 0 0 0 0]
>>> na.sum( na.zeros((2,6)) , -3)
[0 0]
>>> na.sum( na.zeros((2,6)) , -4)
[0 0]
>>> 

I think here should be a ValueError exception thrown rather than defaulting to 
the '-1'-axis.  Comments ?

Thanks,
Sebastian Haase





More information about the Numpy-discussion mailing list