[Python-Dev] accumulator display syntax

Neil Schemenauer nas-python at python.ca
Fri Oct 17 12:57:54 EDT 2003


On Fri, Oct 17, 2003 at 09:10:45AM -0700, Guido van Rossum wrote:
> > (yield x*2 for x in foo)
> > 
> > or maybe:
> > 
> > (yield: x*2 for x in foo)
> 
> Both look decent to me, and in fact the first is what I was thinking
> of this morning in the shower. :-)

So would you write:

    sum(yield: x*2 for x in foo)

or

    sum((yield: x*2 for x in foo))

At the moment I like the latter better.

  Neil



More information about the Python-Dev mailing list