[Python-Dev] accumulator display syntax
Raymond Hettinger
python at rcn.com
Fri Oct 17 17:55:11 EDT 2003
More information about the Python-Dev mailing list
Fri Oct 17 17:55:11 EDT 2003
- Previous message: [Python-Dev] Re: accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[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
- Previous message: [Python-Dev] Re: accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list