summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2023-01-23 11:31:13 (GMT)
committerGitHub <noreply@github.com>2023-01-23 11:31:13 (GMT)
commit5d868efde9ea08b39357b962a02a0294aa97689c (patch)
tree7a31d67e0842f9b9042b133045bde7bb4ee8520f
parent807d6b576fa37f3ab7eb951297cb365c0c198595 (diff)
downloadcpython-5d868efde9ea08b39357b962a02a0294aa97689c.zip
cpython-5d868efde9ea08b39357b962a02a0294aa97689c.tar.gz
cpython-5d868efde9ea08b39357b962a02a0294aa97689c.tar.bz2
Added asyncio REPL example to docs. (#101243)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
-rw-r--r--Doc/library/asyncio.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst
index b71006e..c6a046f 100644
--- a/Doc/library/asyncio.rst
+++ b/Doc/library/asyncio.rst
@@ -56,6 +56,18 @@ 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'
+
.. include:: ../includes/wasm-notavail.rst
.. We use the "rubric" directive here to avoid creating