From: Fred Drake Date: Wed, 12 Dec 2001 06:06:43 +0000 (+0000) Subject: Add a note about yield requiring a __future__ directive. X-Git-Tag: v2.2.1c1~410 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d0645cb84c3a8babce4b9b44c389e175e293b2a;p=thirdparty%2FPython%2Fcpython.git Add a note about yield requiring a __future__ directive. --- diff --git a/Doc/ref/ref6.tex b/Doc/ref/ref6.tex index 1f1486bac748..3089b1af387e 100644 --- a/Doc/ref/ref6.tex +++ b/Doc/ref/ref6.tex @@ -482,6 +482,16 @@ difficulty is that there's no guarantee the generator will ever be resumed, hence no guarantee that the \keyword{finally} block will ever get executed. +\note{In Python 2.2, the \keyword{yield} statement is only allowed +when the \code{generators} feature has been enabled. It will always +be enabled in Python 2.3. This \code{__future__} import statment can +be used to enable the feature:} + +\begin{verbatim} +from __future__ import generators +\end{verbatim} + + \begin{seealso} \seepep{0255}{Simple Generators} {The proposal for adding generators and the \keyword{yield}