title: asyncio: Event vs Future for synchronization
body: <p>I'm going through some <code>asyncio</code> source for networking and implementation raised a question in my head.</p>
  
  <p>To create a non-blocking I/O when waiting for the data to arrive from a socket, <code>asyncio.StreamReader.read()</code> at its end calls <code>_wait_for_data</code> method that <a href="https://github.com/python/cpython/blob/3.6/Lib/asyncio/streams.py#L462-L464" rel="noreferrer">creates an empty <code>Future</code></a> and awaits it.</p>
  
  <p>That future is set as <em>finished</em> (which allows it to be finally awaited) in <a href="https://github.com/python/cpython/blob/3.6/Lib/asyncio/streams.py#L399" rel="noreferrer"><code>_wakeup_waiter</code></a> method that is called <em>when a new data arrives</em> to the stream (<code>feed_data</code> method).</p>
  
  <p>That makes complete sense.</p>
  
  <p><strong>My question is:</strong></p>
  
  <p><strong>Why not use <a href="https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event" rel="noreferrer"><code>asyncio.Event</code></a>?</strong> It feels to me like Event was designed exactly for these purposes. In fact, you wouldn't have to create a new Future on each <code>_wait_for_data</code> call, but would initialize a single Event in a class and would simply toggle its value during its lifetime. It also has specific <code>.wait()</code> method for awaiting its value to become True (for when the new data arrives from the socket).</p>
  
  <p>Can anyone elaborate if there's an actual difference between the two approaches? Or is it just a method chosen arbitrarily?</p>