New text about "from __future__ import generators".
This commit is contained in:
parent
1c2f3d4697
commit
67c021817d
13
pep-0255.txt
13
pep-0255.txt
|
@ -125,10 +125,15 @@ Specification: Yield
|
||||||
yield_stmt: "yield" expression_list
|
yield_stmt: "yield" expression_list
|
||||||
|
|
||||||
"yield" is a new keyword, so a future statement[8] is needed to phase
|
"yield" is a new keyword, so a future statement[8] is needed to phase
|
||||||
this in. [XXX spell this out -- but new keywords have ripple effects
|
this in: in the initial release, a module desiring to use generators
|
||||||
across tools too, and it's not clear this can be forced into the future
|
must include the line
|
||||||
framework at all -- it's not even clear that Python's parser alone can
|
|
||||||
be taught to swing both ways based on a future stmt]
|
from __future__ import generators
|
||||||
|
|
||||||
|
near the top (see PEP 236[8]) for details). Modules using the
|
||||||
|
identifier "yield" without a future statement will trigger warnings.
|
||||||
|
In the following release, yield will be a language keyword and the
|
||||||
|
future statement will no longer be needed.
|
||||||
|
|
||||||
The yield statement may only be used inside functions. A function that
|
The yield statement may only be used inside functions. A function that
|
||||||
contains a yield statement is called a generator function. A generator
|
contains a yield statement is called a generator function. A generator
|
||||||
|
|
Loading…
Reference in New Issue