mirror of
https://github.com/python/cpython.git
synced 2026-01-03 22:12:27 +00:00
[3.10] Added asyncio REPL example to docs. (GH-101243) (#101257)
(cherry picked from commit 5d868efde9)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
This commit is contained in:
parent
5717ab3ac5
commit
e24c73e71e
1 changed files with 11 additions and 0 deletions
|
|
@ -56,6 +56,17 @@ Additionally, there are **low-level** APIs for
|
|||
* :ref:`bridge <asyncio-futures>` callback-based libraries and code
|
||||
with async/await syntax.
|
||||
|
||||
You can experiment with an ``asyncio`` concurrent context in the REPL:
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
$ python -m asyncio
|
||||
asyncio REPL ...
|
||||
Use "await" directly instead of "asyncio.run()".
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import asyncio
|
||||
>>> await asyncio.sleep(10, result='hello')
|
||||
'hello'
|
||||
|
||||
.. We use the "rubric" directive here to avoid creating
|
||||
the "Reference" subsection in the TOC.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue