PEP 255: Simple Generators
Barry A. Warsaw
barry at digicool.com
Wed Jun 20 18:13:00 EDT 2001
>>>>> "DB" == David Bolen <db3l at fitlinxx.com> writes:
DB> But isn't a generator really just a function that is returning
DB> an iterator? That is, why is it "very" different from a
DB> function, internal implementation aside, which we agree it's
DB> not necessary to reveal.
They are very different because the body of a generator function
defines the generator object's .next() method, but the def names the
generator object's factory function.
-Barry
More information about the Python-list
mailing list