scalar object bug or feature?

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


On 10/18/06, Alan G Isaac <aisaac at american.edu> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061018/d1030804/attachment-0001.html 
-------------- 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
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list