summaryrefslogtreecommitdiffstats
path: root/Doc/ref
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-12-12 06:06:43 (GMT)
committerFred Drake <fdrake@acm.org>2001-12-12 06:06:43 (GMT)
commit8d0645cb84c3a8babce4b9b44c389e175e293b2a (patch)
tree790be67890ab3f56c928003aef28f17ad9dea873 /Doc/ref
parent1529ef860e32eae4ce5811ff8a7aa95ebbdd014b (diff)
downloadcpython-8d0645cb84c3a8babce4b9b44c389e175e293b2a.zip
cpython-8d0645cb84c3a8babce4b9b44c389e175e293b2a.tar.gz
cpython-8d0645cb84c3a8babce4b9b44c389e175e293b2a.tar.bz2
Add a note about yield requiring a __future__ directive.
Diffstat (limited to 'Doc/ref')
-rw-r--r--Doc/ref/ref6.tex10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/ref/ref6.tex b/Doc/ref/ref6.tex
index 1f1486b..3089b1a 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}