added chapter map to README

This commit is contained in:
Luciano Ramalho
2019-04-06 07:11:08 -03:00
parent 707ac3ae29
commit 5257010c7f
208 changed files with 45 additions and 12 deletions

12
19-coroutine/coroutil.py Normal file
View File

@@ -0,0 +1,12 @@
# BEGIN CORO_DECO
from functools import wraps
def coroutine(func):
"""Decorator: primes `func` by advancing to first `yield`"""
@wraps(func)
def primer(*args,**kwargs): # <1>
gen = func(*args,**kwargs) # <2>
next(gen) # <3>
return gen # <4>
return primer
# END CORO_DECO