]> granicus.if.org Git - python/commitdiff
bpo-33649: Add a hello world example to asyncio.rst (GH-9374)
authorYury Selivanov <yury@magic.io>
Mon, 17 Sep 2018 22:41:59 +0000 (18:41 -0400)
committerGitHub <noreply@github.com>
Mon, 17 Sep 2018 22:41:59 +0000 (18:41 -0400)
Doc/library/asyncio.rst

index 7895826c65a0647f3d870582a22641b5658c4864..73b0e63a68dbe7fab5796c775f6692cff9614b83 100644 (file)
@@ -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.