A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/065514.html below:

[Python-Dev] feature request: inspect.isgenerator

[Python-Dev] feature request: inspect.isgenerator [Python-Dev] feature request: inspect.isgeneratorMichele Simionato michele.simionato at gmail.com
Thu Jun 1 15:02:20 CEST 2006
Georg Brandl <g.brandl <at> gmx.net> writes:
> 
> > Also, should one add
> > a GeneratorType, perhaps as a subclass of FunctionType?
> 
> Add GeneratorType where? There is already one in the types module.

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

I want isgenerator(g) == True, but isgenerator(go) == False.

So, what should be the class of g ? Maybe we can keep FunctionType
and don't bother.

         Michele Simionato





More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4