[Python-checkins] cpython: Add a sequence diagram for the chained coroutines example
victor.stinner
python-checkins at python.org
Thu Dec 12 12:36:34 CET 2013
http://hg.python.org/cpython/rev/6864abd8e83a
changeset: 87909:6864abd8e83a
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Dec 12 12:35:17 2013 +0100
summary:
Add a sequence diagram for the chained coroutines example
files:
Doc/library/asyncio-task.rst | 11 ++++++++++-
Doc/library/tulip_coro.dia | Bin
Doc/library/tulip_coro.png | Bin
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -74,7 +74,6 @@
loop = asyncio.get_event_loop()
loop.run_until_complete(greet_every_two_seconds())
-
.. seealso::
:ref:`Hello World example using a callback <asyncio-hello-world-callback>`.
@@ -104,6 +103,16 @@
``compute()`` is chained to ``print_sum()``: ``print_sum()`` coroutine waits
until ``compute()`` is completed before returing its result.
+Sequence diagram of the example:
+
+.. image:: tulip_coro.png
+ :align: center
+
+The diagram shows the logical links between the task and the two coroutines, it
+does not describe exactly how things work internally. For example, the sleep
+coroutine creates an internal future which uses
+:meth:`BaseEventLoop.call_later` to wake up the task in 1 second.
+
InvalidStateError
-----------------
diff --git a/Doc/library/tulip_coro.dia b/Doc/library/tulip_coro.dia
new file mode 100644
index 0000000000000000000000000000000000000000..c4e19a066589b568b64cbc3cc9d5d8c60c4a2a08
GIT binary patch
[stripped]
diff --git a/Doc/library/tulip_coro.png b/Doc/library/tulip_coro.png
new file mode 100644
index 0000000000000000000000000000000000000000..e083bc37de88d7fa55bf4124b077aef81b8c798a
GIT binary patch
[stripped]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list