A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038922.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntax [Python-Dev] accumulator display syntaxRaymond Hettinger python at rcn.com
Fri Oct 17 17:55:11 EDT 2003
[GvR]
> > Which is why I didn't like the 'sum[x for x in S]' notation much.

[Alex]
> Let it rest in peace, then.

Goodbye, weird __getitem__ hack!



[GvR]
> > Let's look for an in-line generator notation instead.  I like
> >
> >   sum((yield x for x in S))

[Alex]
> So do I, _with_ the mandatory extra parentheses and all, and in
> fact I think it might be even clearer with the extra colon that Phil
> had mentioned, i.e.
> 
>     sum((yield: x for x in S))

+1



[David Eppstein, in a separate note]
> Along with that confusion, (x*x for x in S) would look like a tuple 
> comprehension, rather than a bare iterator.

Phil's idea cleans that up pretty well:

	(yield: x*x for x in S)

This is no more tuple-like than any expression surrounded by parens.



Raymond Hettinger


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4