Generator Frustration

Joel joel.welling at gmail.com
Mon Jun 20 23:03:39 EDT 2011


On Jun 20, 9:42 pm, Terry Reedy <tjre... at udel.edu> wrote:

>
> A nomenclature note: a function with yield is a 'generator function'. It
> is an instance of the 'function' class, same as for any other def
> statement (or lambda expression). It returns an instance of class
> 'generator, as you note here
>
>  > and will test as such with 'if type(result)==types.GeneratorType:'.
>
> It is the result, and not the function, that is the generator (a type of
> iterator).
>
> --
> Terry Jan Reedy

Yes, quite right.  I stand corrected.

-Joel



More information about the Python-list mailing list