asyncio doc: explain how to pass keywords to callbacks (functools.partial)

This commit is contained in:
Victor Stinner 2014-11-28 13:15:41 +01:00
parent 25c7d3fb21
commit 8464c24c82
2 changed files with 38 additions and 0 deletions

View file

@ -253,6 +253,11 @@ Future
future is already done when this is called, the callback is scheduled
with :meth:`~BaseEventLoop.call_soon`.
:ref:`Use functools.partial to pass parameters to the callback
<asyncio-pass-keywords>`. For example,
``fut.add_done_callback(functools.partial(print, "Future:",
flush=True))`` will call ``print("Future:", fut, flush=True)``.
.. method:: remove_done_callback(fn)
Remove all instances of a callback from the "call when done" list.