Generators are lazy: they only run when you ask for a value. Follow the prints carefully.
def glow(): print("A") yield 1 print("B") yield 2 g = glow() print("start") print(next(g))
A start 1
start A 1 B
start A 1
start 1