Skip to content

Commit

Permalink
Incorporate review comments from @willingc
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrh committed Oct 21, 2018
1 parent 59d3230 commit 30d158d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Doc/library/asyncio-tutorial/async-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ and look like this:
def f(x, y):
print(x + y)
# Evaluate the function
f(1, 2)
The snippet also shows how the function is evaluated. Async functions are
different in two respects:
Async functions are different in two respects:

.. code-block:: python
Expand All @@ -21,13 +21,17 @@ different in two respects:
async def f(x, y):
print(x + y)
# Execute the *async* function above
asyncio.run(f(1, 2))
The first difference is that the function declaration is spelled
``async def``. The second difference is that async functions cannot be
executed by simply evaluating them. Here, we use the ``run()`` function
executed by simply evaluating them. Instead, we use the ``run()`` function
from the ``asyncio`` module.

Executing Async Functions
-------------------------

The ``run`` function is only good for executing an async function
from "synchronous" code; and this is usually only used to execute
a "main" async function, from which others can be called in a simpler
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/asyncio-tutorial/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Asyncio Tutorial
================

Programming with ``async def`` functions is different to normal Python
Programming with ``async def`` functions is differs from normal Python
functions; enough so that it is useful to explain a bit more
about what ``asyncio`` is for, and how to use it in typical
programs.
Expand Down

0 comments on commit 30d158d

Please sign in to comment.