circuitpython/tests/basics/gen_yield_from_send.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
215 B
Python
Raw Normal View History

2014-03-26 13:27:52 -04:00
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")