Browse Source

Coroutine

pull/28/head
Jure Šorn 5 years ago
parent
commit
473229a016
1 changed files with 4 additions and 4 deletions
  1. 8
      README.md

8
README.md

@ -1601,14 +1601,14 @@ def reader(target):
@coroutine
def adder(target):
while True:
item = (yield)
target.send(item + 100)
value = (yield)
target.send(value + 100)
@coroutine
def printer():
while True:
item = (yield)
print(item)
value = (yield)
print(value)
reader(adder(printer())) # 100, 101, ..., 109
```

Loading…
Cancel
Save