summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2023-01-23 11:52:38 (GMT)
committerGitHub <noreply@github.com>2023-01-23 11:52:38 (GMT)
commite24c73e71e952028bc702a741241ff79c23eb30e (patch)
tree27cbb3261033ed2e2b36ee4102edb0bceb0b2ef2 /Doc
parent5717ab3ac50aa91d19c1f44f970e7db92619f2c0 (diff)
downloadcpython-e24c73e71e952028bc702a741241ff79c23eb30e.zip
cpython-e24c73e71e952028bc702a741241ff79c23eb30e.tar.gz
cpython-e24c73e71e952028bc702a741241ff79c23eb30e.tar.bz2
[3.10] Added asyncio REPL example to docs. (GH-101243) (#101257)
(cherry picked from commit 5d868efde9ea08b39357b962a02a0294aa97689c) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/asyncio.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst
index a642939..8a6526e 100644
--- a/Doc/library/asyncio.rst
+++ b/Doc/library/asyncio.rst
@@ -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.