]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] Added asyncio REPL example to docs. (GH-101243) (#101257)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Mon, 23 Jan 2023 11:52:38 +0000 (17:22 +0530)
committerGitHub <noreply@github.com>
Mon, 23 Jan 2023 11:52:38 +0000 (17:22 +0530)
(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>
Doc/library/asyncio.rst

index a6429394389b104d72669f5da0c7cbccbc5362f9..8a6526ed9022fe8dc27b13522bfbf81ca659be7a 100644 (file)
@@ -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.