[Python-ideas] Generators are iterators

Ron Adam ron3200 at gmail.com
Sun Dec 14 03:46:43 CET 2014

On 12/13/2014 07:38 PM, Chris Angelico wrote:
> 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.

I see only two things... functions that do exactly what's in the defined 
body when called,  and generator_functions which does something other than 
what is defined in the body when called.

That seems like quite a difference to me.


More information about the Python-ideas mailing list