summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/gen_yield_from_send.py
blob: c2e94b5ad88a82b2a7bca9562cc44cc34c64a9d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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")