Why does inspect.isgenerator() return false for this class generator definition (working in python 3.7)?
I know that isgenerator is checking weather the object is of type
"generator"
and my class is of type
"__main__.generator"
which I don't know why. How do I make it of type "generator"? (I need this because of some other 3rd library which is checking this).
class generator(object):
def __init__(self):
pass
def __getitem__(self, index):
return [0,0]
def __iter__(self):
return self
def __next__(self):
return [0,0]
def next(self):
return self.__next__()
a = generator()
import inspect
print(inspect.isgenerator(a))
print(type(a))
thanks for help!