Re: [Numpy-discussion] Different behaviour of python built sum and addition on ndarrays

2012-04-16 Thread Nathaniel Smith
On Mon, Apr 16, 2012 at 11:06 PM, Christopher Mutel wrote: > So, for both 1.5 and 1.6 (at least), it appears that the builtin sum > does not add ndarrays the way "+" (and operator.add) do: > > a = np.arange(10).reshape((2,5)) > b = np.arange(10, 20).reshape((2,5)) > sum(a,b) > Out[5]: > array([[15

[Numpy-discussion] Different behaviour of python built sum and addition on ndarrays

2012-04-16 Thread Christopher Mutel
So, for both 1.5 and 1.6 (at least), it appears that the builtin sum does not add ndarrays the way "+" (and operator.add) do: a = np.arange(10).reshape((2,5)) b = np.arange(10, 20).reshape((2,5)) sum(a,b) Out[5]: array([[15, 18, 21, 24, 27], [20, 23, 26, 29, 32]]) a + b Out[6]: array([[10,