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/038927.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntaxSean Ross seandavidross at hotmail.com
Fri Oct 17 18:08:08 EDT 2003
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.



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