diff --git a/examples/run_in_thread.py b/examples/run_in_thread.py index 3234481..5a704dc 100644 --- a/examples/run_in_thread.py +++ b/examples/run_in_thread.py @@ -1,15 +1,16 @@ import asyncio + def compute_pi(digits): # implementation return 3.14 -async def main(): +async def main(loop): digits = await loop.run_in_executor(None, compute_pi, 20000) print("pi: %s" % digits) loop = asyncio.get_event_loop() -loop.run_until_complete(main()) +loop.run_until_complete(main(loop)) loop.close() diff --git a/examples/synchronous_client.py b/examples/synchronous_client.py index 46eb177..bef9576 100644 --- a/examples/synchronous_client.py +++ b/examples/synchronous_client.py @@ -19,7 +19,7 @@ def get_encoding(http_response): def get_page(host, port, wait=0): - """Get one page suppling `wait` time. + """Get one page supplying `wait` time. The path will be build with: `host:port/wait` """ diff --git a/index.rst b/index.rst index 492872e..c003603 100644 --- a/index.rst +++ b/index.rst @@ -3,7 +3,7 @@ Asyncio Documentation +++++++++++++++++++++ Chapter 1: First steps with asyncio -==================================== +=================================== .. toctree:: :maxdepth: 2 @@ -18,7 +18,7 @@ Chapter 1: First steps with asyncio Chapter 2: Advanced topics -=========================== +========================== .. toctree:: :maxdepth: 2 @@ -55,7 +55,6 @@ See also * `A Web Crawler With asyncio Coroutines `_ by A. Jesse Jiryu Davis and Guido van Rossum -* `asyncio.org `_ * `Writing Redis in Python with asyncio: Part 1 `_ by James Saryerwinnie diff --git a/why_asyncio.rst b/why_asyncio.rst index 695e8ef..8bee9f9 100644 --- a/why_asyncio.rst +++ b/why_asyncio.rst @@ -1,6 +1,6 @@ -++++++++++++++++++ +++++++++++++++++ Why use asyncio? -++++++++++++++++++ +++++++++++++++++ Why asynchronous programming? =============================