GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing hg.python.org — hg.python.org

changeset: 106463:514571268743 branch: 3.5 parent: 106460:0f5161f865d7 user: Berker Peksag date: Tue Feb 07 11:27:09 2017 +0300 files: Doc/library/asyncio-task.rst description: Issue #29441: Update examples to use async and await keywords in asyncio-task.rst diff -r 0f5161f865d7 -r 514571268743 Doc/library/asyncio-task.rst --- a/Doc/library/asyncio-task.rst Mon Feb 06 22:03:00 2017 -0800 +++ b/Doc/library/asyncio-task.rst Tue Feb 07 11:27:09 2017 +0300 @@ -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):
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.