Calling a generator multiple times
sdm7g at Virginia.EDU
Mon Dec 10 16:34:39 CET 2001
On Sun, 9 Dec 2001, Tim Peters wrote:
> [Steven Majewski]
> > ...
> > Generators, functions and methods are just slight variations on each
> > other.
> Absolutely. People should consider *all* callable objects in 2.2 to be
> generators -- it's just that if the body doesn't contain "yield", then the
> language helpfully calls .next() once for you by magic <wink>.
Well, I know I don't have to tell Tim that, semantically speaking,
functions and subroutines are just a specialized subcase of
semi-coroutines (which are a specialized case of coroutines).
-- Steve Majewski
More information about the Python-list