[Python-Dev] accumulator display syntax

Barry Warsaw barry at python.org
Tue Oct 21 18:07:22 EDT 2003

On Tue, 2003-10-21 at 17:59, Raymond Hettinger wrote:
> [Guido]
> > I expect that most iterator comprehensions (we need a better term!)
> > are not stored in a variable but passed as an argument to something
> > that takes an iterable, e.g.
> > 
> >   sum(len(line) for line in file if line.strip())
> That is somewhat beautiful.

Indeed, as is the term "generator expression" and the relegation to
syntactic sugar of list comprehensions.

> > We can quibble about whether double parentheses are needed
> I vote for not requiring the outer parentheses unless there is an
> adjacent comma.

I like that too.  It mirrors other situations where the parentheses
aren't needed except to disambiguate syntax.  In the above example,
there's no ambiguity.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20031021/53953213/attachment.bin

More information about the Python-Dev mailing list