From: Yury Selivanov Date: Mon, 17 Sep 2018 22:41:59 +0000 (-0400) Subject: bpo-33649: Add a hello world example to asyncio.rst (GH-9374) X-Git-Tag: v3.8.0a1~957 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3085534c398e6b181e7a9ac0cb9c80f3c670f2b9;p=thirdparty%2FPython%2Fcpython.git bpo-33649: Add a hello world example to asyncio.rst (GH-9374) --- diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst index 7895826c65a0..73b0e63a68db 100644 --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -6,6 +6,19 @@ -------------- +.. sidebar:: Hello World! + + .. code-block:: python + + import asyncio + + async def main(): + print('Hello ...') + await asyncio.sleep(1) + print('... World!') + + asyncio.run(main()) + asyncio is a library to write **concurrent** code using **async/await** syntax.