def sample():
  yield 1
  yield 2
  yield 3

x = sample()
print(x) # <generator object sample at 0x1005e5900>

next(x) # 1
next(x) # 2
next(x) # 3
next(x) # エラー StopIteration
