# creating the list
L = [1,2,3,4,5,6]
# defining the generator
def generator(l):
for i in l: yield i
while True: yield None
g = generator(L)
print(next(g)) # 1
print(next(g)) # 2
print(next(g)) # 3
print(next(g)) # 4
print(next(g)) # 5
print(next(g)) # 6
print(next(g)) # None
print(next(g)) # None
print(next(g)) # None