[Python-checkins] cpython (merge 3.6 -> default): Issue #29441: Merge from 3.6

berker.peksag python-checkins at python.org
Tue Feb 7 03:23:14 EST 2017


https://hg.python.org/cpython/rev/ee074604bf0c
changeset:   106465:ee074604bf0c
parent:      106462:9f16900bebaa
parent:      106464:975e03b0aea6
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Tue Feb 07 11:28:19 2017 +0300
summary:
  Issue #29441: Merge from 3.6

files:
  Doc/library/asyncio-task.rst |  21 ++++-----------------
  1 files changed, 4 insertions(+), 17 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
@@ -136,17 +136,6 @@
     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 @@
 
     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 @@
 
     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):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list