Browse Source

Coroutine

pull/44/head
Jure Šorn 5 years ago
parent
commit
e44c8ba83e
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -2211,7 +2211,7 @@ Coroutine
### Helper Decorator
* **All coroutines must first be "primed" by calling `'next(<coroutine>)'`.**
* **Remembering to call next() is easy to forget.**
* **Solved by wrapping functions that return a coroutine with a decorator:**
* **Solved by wrapping coroutine functions with a following decorator:**
```python
def coroutine(func):

2
index.html

@ -1915,7 +1915,7 @@ ValueError: malformed node or string
</ul><div><h3 id="helperdecorator">Helper Decorator</h3><ul>
<li><strong>All coroutines must first be "primed" by calling <code class="python hljs"><span class="hljs-string">'next(&lt;coroutine&gt;)'</span></code>.</strong></li>
<li><strong>Remembering to call next() is easy to forget.</strong></li>
<li><strong>Solved by wrapping functions that return a coroutine with a decorator:</strong></li>
<li><strong>Solved by wrapping coroutine functions with a following decorator:</strong></li>
</ul><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">coroutine</span><span class="hljs-params">(func)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">out</span><span class="hljs-params">(*args, **kwargs)</span>:</span>
cr = func(*args, **kwargs)

Loading…
Cancel
Save