[docs] [issue22473] The gloss on asyncio "future with run_forever" example is confusing

STINNER Victor report at bugs.python.org
Wed Sep 24 16:39:37 CEST 2014


STINNER Victor added the comment:

"But that isn't quite true.  It is the callback associated with the future that is displaying the result and stopping the loop."

I wrote this example to show that setting the result of a future can schedule a callback. I mean something like:

"In this example, the future is used to link slow_operation() to got_result(): when slow_operation() is done, got_result() is called with the result."

The main idea behind Future is to chain callbacks and the link is done externally. It's different from this design:

    def slow_operation(done_callback):
        ...
        done_callback()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22473>
_______________________________________


More information about the docs mailing list