[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
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