You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
215 B
14 lines
215 B
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")
|
|
|