def generator():
yield 1
yield 2
yield 3
yield 4
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator))
the error on vs is print(next(generator)) TypeError: 'function' object is not an iterator
i think the output should be 1 2 3 4
so why this error happend ?