About that 'yield' word
David Eppstein
eppstein at ics.uci.edu
Sat Oct 4 16:11:08 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
> >
> >
> > ???
I guess this was just thrown together as an example of "yield", rather
than real code, but:
def maker():
return range(100)
seems a little less contorted...
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list