mirror of
https://github.com/python/cpython.git
synced 2025-11-12 23:16:47 +00:00
Clarify when iter() is first called in generator expressions.
This commit is contained in:
parent
8bc81fc5c7
commit
956e4f792f
1 changed files with 3 additions and 3 deletions
|
|
@ -105,13 +105,13 @@ friendly than equivalent list comprehensions.
|
||||||
is equivalent to:
|
is equivalent to:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
def _generator(exp):
|
def __gen(exp):
|
||||||
for var1 in exp:
|
for var1 in exp:
|
||||||
for var2 in exp2:
|
for var2 in exp2:
|
||||||
if exp3:
|
if exp3:
|
||||||
yield tgtexp
|
yield tgtexp
|
||||||
g = _generator(exp1)
|
g = __gen(iter(exp1))
|
||||||
del _generator
|
del __gen
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The advantage over full generator definitions is in economy of
|
The advantage over full generator definitions is in economy of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue