Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
08850764
Commit
08850764
authored
Feb 07, 2017
by
Berker Peksag
Browse files
Options
Browse Files
Download
Plain Diff
Issue #29441: Merge from 3.5
parents
6138432e
f5928679
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
17 deletions
+4
-17
Doc/library/asyncio-task.rst
Doc/library/asyncio-task.rst
+4
-17
No files found.
Doc/library/asyncio-task.rst
View file @
08850764
...
...
@@ -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):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment