mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
Don't make promises about about the visibility of the induction variable.
This commit is contained in:
parent
e4b9d8c2ba
commit
f12f32421f
1 changed files with 0 additions and 12 deletions
|
|
@ -1949,18 +1949,6 @@ applied to functions with more than one argument and to nested functions:
|
||||||
['3.1', '3.14', '3.142', '3.1416', '3.14159']
|
['3.1', '3.14', '3.142', '3.1416', '3.14159']
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
To make list comprehensions match the behavior of \keyword{for}
|
|
||||||
loops, assignments to the loop variable remain visible outside
|
|
||||||
of the comprehension:
|
|
||||||
|
|
||||||
\begin{verbatim}
|
|
||||||
>>> x = 100 # this gets overwritten
|
|
||||||
>>> [x**3 for x in range(5)]
|
|
||||||
[0, 1, 8, 27, 64]
|
|
||||||
>>> x # the final value for range(5)
|
|
||||||
4
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
|
|
||||||
\section{The \keyword{del} statement \label{del}}
|
\section{The \keyword{del} statement \label{del}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue