[Python-Dev] feature request: inspect.isgenerator

Terry Reedy tjreedy at udel.edu
Thu Jun 1 17:57:15 CEST 2006


"Michele Simionato" <michele.simionato at gmail.com> wrote in message 
news:loom.20060601T145807-833 at post.gmane.org...
> Yep, this is the crux. types.GeneratorType refers to generator objects,
> which in an improper sense are "instances" of a "generator function".
> I.e.
>> def g(): yield 1 # this is a generator
>> go = g() # this is a generator object

That terminology does not work. For every other type, an x is an x object 
and vice versa. I think most of us call functions which return generators 
a generator function when the distinction needs to be made. A generator is 
a type in the conceptual class 'iterator'.
Terry Jan Reedy


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /