isgenerator(...) - anywhere to be found?

Diez B. Roggisch deets at nospam.web.de
Tue Jan 22 08:20:35 EST 2008


For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question

isgenerator(v)

but didn't find any implementation in the usual suspects - builtins or
inspect.

I was able to help myself out with a simple (out of my head, hope its

def isgenerator(v):
    def _g(): yield
    return type(v) == type(_g())

But I wonder why there is no such method already available?

Diez



More information about the Python-list mailing list