Document await
This commit is contained in:
parent
1b1a6d7684
commit
0fcf570a3f
@ -224,6 +224,23 @@ Examples of usage:
|
|||||||
.. note:: ``assoc`` modifies the datastructure in place and returns ``None``.
|
.. note:: ``assoc`` modifies the datastructure in place and returns ``None``.
|
||||||
|
|
||||||
|
|
||||||
|
await
|
||||||
|
-----
|
||||||
|
|
||||||
|
``await`` creates an :ref:`await expression <py:await>`. It takes exactly one
|
||||||
|
argument: the object to wait for.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
=> (import asyncio)
|
||||||
|
=> (defn/a main []
|
||||||
|
... (print "hello")
|
||||||
|
... (await (asyncio.sleep 1))
|
||||||
|
... (print "world"))
|
||||||
|
=> (asyncio.run (main))
|
||||||
|
hello
|
||||||
|
world
|
||||||
|
|
||||||
break
|
break
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user