summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-02-07 08:28:19 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2017-02-07 08:28:19 (GMT)
commitee0ee9ae8e9111a5ce8a09e7b705cfd380394ce7 (patch)
treeb4ad81945d163dee67528b3eeca4dcce447a1f71
parent189413dcfe1a3e8747457e3d5b6f66f8cd312e15 (diff)
parent088507644e0cc396a24898c6e7ecb85daf2cbe0e (diff)
downloadcpython-ee0ee9ae8e9111a5ce8a09e7b705cfd380394ce7.zip
cpython-ee0ee9ae8e9111a5ce8a09e7b705cfd380394ce7.tar.gz
cpython-ee0ee9ae8e9111a5ce8a09e7b705cfd380394ce7.tar.bz2
Issue #29441: Merge from 3.6
-rw-r--r--Doc/library/asyncio-task.rst21
1 files changed, 4 insertions, 17 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index 90cb9c3..558d17c 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -136,17 +136,6 @@ using the :meth:`sleep` function::
loop.run_until_complete(display_date(loop))
loop.close()
-The same coroutine implemented using a generator::
-
- @asyncio.coroutine
- def display_date(loop):
- end_time = loop.time() + 5.0
- while True:
- print(datetime.datetime.now())
- if (loop.time() + 1.0) >= end_time:
- break
- yield from asyncio.sleep(1)
-
.. seealso::
The :ref:`display the current date with call_later()
@@ -309,9 +298,8 @@ Example combining a :class:`Future` and a :ref:`coroutine function
import asyncio
- @asyncio.coroutine
- def slow_operation(future):
- yield from asyncio.sleep(1)
+ async def slow_operation(future):
+ await asyncio.sleep(1)
future.set_result('Future is done!')
loop = asyncio.get_event_loop()
@@ -341,9 +329,8 @@ flow::
import asyncio
- @asyncio.coroutine
- def slow_operation(future):
- yield from asyncio.sleep(1)
+ async def slow_operation(future):
+ await asyncio.sleep(1)
future.set_result('Future is done!')
def got_result(future):