PEP 289: Generator Expressions (please comment)
Chris Wright
caw at cs.mu.oz.au
Tue Oct 28 17:09:23 EST 2003
PEP 289 proposes stuff like
> sum(x*x for x in roots)
> min(d.temperature()*9/5 + 32 for d in days)
> Set(word.lower() for word in text.split() if len(word) < 5)
> dict( (k, somefunc(k)) for k in keylist )
> dotproduct = sum(x*y for x,y in itertools.izip(xvec, yvec))
> bestplayer, bestscore = max( (p.score, p.name) for p in players )
and it seems that it's been accepted.
I meekly accept the judgement of BDFL, but have a sneaking suspicion
that we're on the way to re-inventing the LOOP macro here!
I can see the appeal, but fear where it might lead us ...
cheers
Chris Wright
More information about the Python-list
mailing list