title: What is the use case for future.add_done_callback()?
body: <p>I understand how to add a callback method to a future and have it called when the future is done.  But why is this helpful when you can already call functions from inside coroutines?</p>
  
  <p>Callback version:</p>
  
  <pre><code>def bar(future):
      # do stuff using future.result()
      ...
  
  async def foo(future):
      await asyncio.sleep(3)
      future.set_result(1)
  
  loop = asyncio.get_event_loop()
  future = loop.create_future()
  future.add_done_callback(bar)
  loop.run_until_complete(foo(future))
  </code></pre>
  
  <p>Alternative:</p>
  
  <pre><code>async def foo():
      await asyncio.sleep(3)
      bar(1)
  
  loop = asyncio.get_event_loop()
  loop.run_until_complete(foo())
  </code></pre>
  
  <p>When would the second version not be available/suitable?</p>