def gen(name):
while 1:
print(f'{name} ready to ea')
food = yield 666#print(next(dog)) #print(dog.send('骨头2')) # print(dog.send('骨头4'))
food1 = yield 667#print(dog.send('骨头1')) # print(dog.send('骨头3'))
print(f'{name} start to eat {food}{food1}')
dog = gen('alex')
print(next(dog))
print(dog.send('骨头1'))
print(dog.send('骨头2'))
print(dog.send('骨头3'))
print(dog.send('骨头4'))
alex ready to ea
666
667
alex start to eat 骨头1骨头2
alex ready to ea
666
667
alex start to eat 骨头3骨头4
alex ready to ea
666