Next on generators doesn't resume with last call

Viewed 46

Why the second next doesn't return "bye" ?

def salute():
    yield "hello"
    yield "bye"


def greet_me():
    print(next(salute()))
    print(next(salute()))

greet_me()

Output :

hello

hello

1 Answers
Related