PEP 289: Generator Expressions (please comment)

Bjorn Pettersen bjorn.pettersen at comcast.net
Thu Oct 23 21:29:06 EDT 2003


Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote in
news:7xk76v8mra.fsf at ruckus.brouhaha.com: 

> python at rcn.com (Raymond Hettinger) writes:
>> In brief, the PEP proposes a list comprehension style syntax for
>> creating fast, memory efficient generator expressions on the fly:
>> 
>>     sum(x*x for x in roots)
> 
[..]

> Note there's no builtin function "sum".  It's always annoyed me that
> operator.add always takes exactly two arguments, so you have to use
> reduce.
[..]

time to upgrade?

f:\>python
Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> sum(range(10))
45

-- bjorn




More information about the Python-list mailing list