Browse Source

Coroutines

pull/187/head
Jure Šorn 7 months ago
parent
commit
d8251cf430
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -2314,9 +2314,9 @@ import asyncio as aio
```
```python
<coro> = <async_func>(<args>) # Creates a coroutine.
<coro> = <async_function>(<args>) # Creates a coroutine by calling async def function.
<obj> = await <coroutine> # Starts the coroutine and returns result.
<task> = aio.create_task(<coroutine>) # Schedules coroutine for execution.
<task> = aio.create_task(<coroutine>) # Schedules the coroutine for execution.
<obj> = await <task> # Returns result. Also <task>.cancel().
```

4
index.html

@ -1905,9 +1905,9 @@ delattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>)
</code></pre></div>
<pre><code class="python language-python hljs">&lt;coro&gt; = &lt;async_func&gt;(&lt;args&gt;) <span class="hljs-comment"># Creates a coroutine.</span>
<pre><code class="python language-python hljs">&lt;coro&gt; = &lt;async_function&gt;(&lt;args&gt;) <span class="hljs-comment"># Creates a coroutine by calling async def function.</span>
&lt;obj&gt; = <span class="hljs-keyword">await</span> &lt;coroutine&gt; <span class="hljs-comment"># Starts the coroutine and returns result.</span>
&lt;task&gt; = aio.create_task(&lt;coroutine&gt;) <span class="hljs-comment"># Schedules coroutine for execution.</span>
&lt;task&gt; = aio.create_task(&lt;coroutine&gt;) <span class="hljs-comment"># Schedules the coroutine for execution.</span>
&lt;obj&gt; = <span class="hljs-keyword">await</span> &lt;task&gt; <span class="hljs-comment"># Returns result. Also &lt;task&gt;.cancel().</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;coro&gt; = aio.gather(&lt;coro/task&gt;, ...) <span class="hljs-comment"># Schedules coroutines. Returns results when awaited.</span>

Loading…
Cancel
Save