I
imho
Hi all.
Is there a way to know if a function object is actually a "generator
function" or not ? e.g.:
def f():
pass
def g():
yield None
f.__class__ is the same as g.__class__ , i.e. "function" type.
But i "know" that the second, when invoked, returns a generator object,
because there is a "yield" statement in its body.
Is there a (eventually hackish) method to get such information ?
Thanks in advance,
Diego.
Is there a way to know if a function object is actually a "generator
function" or not ? e.g.:
def f():
pass
def g():
yield None
f.__class__ is the same as g.__class__ , i.e. "function" type.
But i "know" that the second, when invoked, returns a generator object,
because there is a "yield" statement in its body.
Is there a (eventually hackish) method to get such information ?
Thanks in advance,
Diego.