1def mygen(): 2 """Yield 5 until something else is passed back via send()""" 3 a = 5 4 while True: 5 f = yield(a) #yield a and possibly get f in return 6 if f is not None: a = f #store the new value 7 8g = mygen() 9print(next(g)) 10print(next(g)) 11g.send(7) 12print(next(g)) 13 14