We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.


COMMENT: This is a bit inaccurate. Generator functions are implemented as ordinary function objects, which returns generator objects when called.

Generator functions

A function or method which uses the yield statement is called a generator function. Such a function, when called, always returns an iterator object which can be used to execute the body of the function: calling the iterator’s next method will cause the function to execute until it provides a value using the yield statement. When the function executes a return statement or falls off the end, a StopIteration exception is raised and the iterator will have reached the end of the set of values to be returned.