[Python-Dev] accumulator display syntax
Sean Ross
seandavidross at hotmail.com
Fri Oct 17 18:08:08 EDT 2003
More information about the Python-Dev mailing list
Fri Oct 17 18:08:08 EDT 2003
- Previous message: [Python-Dev] accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello. Perhaps looking at some examples of what nested itercomps might look like (because they _will_ be used if they're available...) using each of the leading syntaxes would be useful in trying to decide which form, if any, is most acceptable (or least unacceptable, whichever the case may be): # (1) without parentheses: B(y) for y in A(x) for x in myIterable # (2) for clarity, we'll add some optional parentheses: B(y) for y in (A(x) for x in myIterable) # (3) OK. Now, with required parentheses: (B(y) for y in (A(x) for x in myIterable)) # (4) And, now with the required "yield:" and parentheses: (yield: B(y) for y in (yield: A(x) for x in myIterable)) #(5) And, finally, for completeness, using the rejected PEP 289 syntax: [yield B(y) for y in [yield A(x) for x in myIterable]] Hope that's useful, Sean p.s. I'm only a Python user, and not a developer, so if my comments are not welcome here, please let me know, and I will refrain in future. Thanks for your time.
- Previous message: [Python-Dev] 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