scalar object bug or feature?

Charles R Harris charlesr.harris at
Wed Oct 18 16:03:32 CDT 2006

On 10/18/06, Alan G Isaac <aisaac at> wrote:
> On Wed, 18 Oct 2006, Keith Goodman apparently wrote:


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)

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.

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
-------------- next part --------------
Numpy-discussion mailing list
Numpy-discussion at

More information about the Numpy-discussion mailing list