Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d0645c

Browse files
committed
Add a note about yield requiring a __future__ directive.
1 parent 1529ef8 commit 8d0645c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Doc/ref/ref6.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,16 @@ \section{The \keyword{yield} statement \label{yield}}
482482
resumed, hence no guarantee that the \keyword{finally} block will ever
483483
get executed.
484484
485+
\note{In Python 2.2, the \keyword{yield} statement is only allowed
486+
when the \code{generators} feature has been enabled. It will always
487+
be enabled in Python 2.3. This \code{__future__} import statment can
488+
be used to enable the feature:}
489+
490+
\begin{verbatim}
491+
from __future__ import generators
492+
\end{verbatim}
493+
494+
485495
\begin{seealso}
486496
\seepep{0255}{Simple Generators}
487497
{The proposal for adding generators and the \keyword{yield}

0 commit comments

Comments
 (0)