Skip to content

Commit 0fffd4b

Browse files
committed
- Remove await-ing Tasks and futures section
1 parent 64a12b4 commit 0fffd4b

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

Doc/howto/a-conceptual-overview-of-asyncio.rst

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -333,34 +333,6 @@ Futures are much more versatile and will be marked as done when you say so.
333333
In this way, they're the flexible interface for you to make your own conditions
334334
for waiting and resuming.
335335

336-
===========================
337-
await-ing Tasks and futures
338-
===========================
339-
340-
``Future`` defines an important method: ``__await__``. Below is the actual
341-
implementation (well, one line was removed for simplicity's sake) found
342-
in ``asyncio.futures.Future``.
343-
It's okay if it doesn't make complete sense now, we'll go through it in detail
344-
in the control-flow example.
345-
346-
::
347-
348-
1 class Future:
349-
2 ...
350-
3 def __await__(self):
351-
4
352-
5 if not self.done():
353-
6 yield self
354-
7
355-
8 if not self.done():
356-
9 raise RuntimeError("await wasn't used with future")
357-
10
358-
11 return self.result()
359-
360-
The ``Task`` class does not override ``Future``'s ``__await__`` implementation.
361-
``await``\ ing a task or future invokes that above ``__await__`` method and
362-
percolates the ``yield`` on line 6 to relinquish control to its caller, which
363-
is generally the event loop.
364336

365337
========================
366338
A homemade asyncio.sleep

0 commit comments

Comments
 (0)