import types class ContentGenerator object def __init__ self self coun

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import types
class ContentGenerator(object):
def __init__(self):
self.count = 0
def __iter__(self):
return self
# Python 3 compatibility
def __next__(self):
return self.next()
def next(self):
self.count += 1
return 'foo'
gen = ()
print(isinstance(gen, types.GeneratorType))