Lets say I have two functions:
def foo(): return \'foo\' def bar(): yield \'bar\'
The first one is a normal function, and the second i
>>> import inspect >>> >>> def foo(): ... return 'foo' ... >>> def bar(): ... yield 'bar' ... >>> print inspect.isgeneratorfunction(foo) False >>> print inspect.isgeneratorfunction(bar) True