lbolla at gmail.com
Mon Jan 8 10:23:59 EST 2007
I'm fairly new to Numpy and, while experimenting, I found a strange (i.e.
not expected by me!) behaviour of arrays.
I tried this (in comment what I get):
x = arange(4) # x = array([0,1,2,3])
def myadd(x,y): # re-define the binary sum function
return x + y
reduce(myadd, x) # 6, as expected
add.reduce(x) # 6, as expected
def mysub(x,y): # re-define the binary diff function
return x - y
reduce(mysub, x) # -6, as expected
subtract.reduce(x) # 2 ---> WHY?
Can someone explain me this?
Thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion