About that 'yield' word
Alex Martelli
aleax at aleax.it
Sat Oct 4 15:49:50 EDT 2003
Tobiah wrote:
>
> def maker():
> for i in range(100):
> yield i
>
>
> foo:4: Warning: 'yield' will become a reserved keyword in the future
> File "foo", line 4
> yield i
> ^
> SyntaxError: invalid syntax
>
> Python 2.2.2
>
>
> ???
You seem to have omitted the necessary statement at the start
of your module (in Python 2.2):
from __future__ import generators
Alternatively, upgrade to 2.3, and you won't need that statement
any more.
Alex
More information about the Python-list
mailing list