micropython/tests/basics/gen-yield-from-send.py
2014-03-28 02:50:56 +02:00

15 lines
215 B
Python

def gen():
print("sent:", (yield 1))
yield 2
def gen2():
print((yield from gen()))
g = gen2()
next(g)
print("yielded:", g.send("val"))
try:
next(g)
except StopIteration:
print("StopIteration")