From: Charles R H. <cha...@gm...> - 2006-10-18 21:03:38
|
On 10/18/06, Alan G Isaac <ai...@am...> wrote: > > On Wed, 18 Oct 2006, Keith Goodman apparently wrote: <snip> Here's a simpler (?) example: > >>> x=numpy.random.rand(300,1)>0 > >>> x.sum() > 300 > >>> sum(x) > array([44], dtype=int8) > >>> x=numpy.random.rand(300)>0 > >>> sum(x) > 300 > > Alan Isaac Hmmm, I think sum(x) and x.sum() should behave the same. Note that In [12]:sum(x, dtype=int) Out[12]:300 I think sum should stick to the modular arithmetic unless specified otherwise. But in any case sum(x) and x.sum() should do the same thing. Chuck |