[SciPy-user] numpy.sum and generator expressions

Neilen Marais nmarais at sun.ac.za
Tue Aug 29 03:37:43 CDT 2006

On Mon, 28 Aug 2006 14:01:59 -0600, Travis Oliphant wrote:

> Neilen Marais wrote:
>> but with 1.0b4 I get:
>> In [14]: N.sum(i for i in range(3))
>> Out[14]: <generator object at 0x2aaaae5e3248>
>> Is this the (new?) expected bahaviour, or is it a bug? I hope for the
>> latter, since I use generators like this quite a bit...
> It's a bug.  It was introduced when adding an optional output argument 
> to sum.  In the sum function in fromnumeric.py there needs to be a 
> return res statement in the check for a generator type.
> This is fixed in SVN.

Great, thanks for the fix.


> -Travis

you know its kind of tragic 
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)

More information about the SciPy-user mailing list