[Python-ideas] Generators are iterators

Chris Angelico rosuav at gmail.com
Sun Dec 14 02:38:25 CET 2014


On Sun, Dec 14, 2014 at 12:33 PM, Ron Adam <ron3200 at gmail.com> wrote:
> The term generator_function was use quite a lot in the PEP discussion in
> order to distinguish it from a regular function, and also from the generator
> returned from it.  So it seems to me, that maybe there is something to that.

Many things can be distinguished that are not distinct types. A
generator function is a function that has a 'yield' in it. A factory
function is a function that constructs and returns a new object. A
recursive function is a function which calls itself. All three are
functions in every way.

ChrisA


More information about the Python-ideas mailing list