On 8/27/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
The numarray.sum also fails to accept a generator as an argument. Because python does and the imported sum overwrites it, we should probably check the argument type and make it do the right thing.
Chuck
Hi,On 8/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It seems like numpy.sum breaks generator expressions:
In [1]: sum(i*i for i in range(10))
Out[1]: 285
In [2]: from numpy import sum
In [3]: sum(i*i for i in range(10))
Out[3]: <generator object at 0x10eca58>
Is this intentional? If so, how do I get the behaviour that I am after?In [3]: sum([i*i for i in range(10)])Out[3]: 285
Chuck
The numarray.sum also fails to accept a generator as an argument. Because python does and the imported sum overwrites it, we should probably check the argument type and make it do the right thing.
Chuck
------------------------------------------------------------------------- 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
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion