[SciPy-dev] numpy changes generator behaviour

Christopher Fonnesbeck chris at trichech.us
Mon Jan 9 09:01:35 EST 2006


I'm not sure this is intended, but it appears that numpy changes the  
behaviour of the new python 2.4 generators. Here is what is supposed  
to happen:

 >>> sum(x*x for x in range(10))
285

But if I import numpy, and try again I get:

 >>> from numpy import *
 >>> sum(x*x for x in range(10))
<generator object at 0x5ae90>

Why should it no longer sum?

C.

--
Christopher J. Fonnesbeck

Population Ecologist, Marine Mammal Section
Fish & Wildlife Research Institute (FWC)
St. Petersburg, FL

Adjunct Assistant Professor
Warnell School of Forest Resources
University of Georgia
Athens, GA

T: 727.235.5570
E: chris at trichech.us


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060109/c9f01719/attachment.bin>


More information about the SciPy-Dev mailing list