title: async python - yield from raises AssertionError for correct parameters
body: <p>My requirement is to run 2 functions at the same time and stop execution of one if the another one calculates and returns a result faster.</p>
  
  <p>I have know knowledge of async programming or event loops. I read <a href="https://docs.python.org/3/library/asyncio-eventloop.html#run-an-event-loop" rel="nofollow noreferrer">python 3.6</a> which lead me to <a href="https://docs.python.org/3/library/asyncio-task.html#asyncio.wait" rel="nofollow noreferrer">asyncio.wait()</a></p>
  
  <p>My sample code:</p>
  
  <pre><code>import time
  import asyncio as aio
  
  async def f(x):
      time.sleep(1) # to fake fast work
      print("f say: " + str(x*2))
      return x*2
  
  async def s(x):
      time.sleep(3) # to fake slow work
      print("s say: " + str(x*2))
      return x**2
  
  x = 10
  
  assert aio.iscoroutinefunction(f)
  assert aio.iscoroutinefunction(s)
  
  futures = {f(x), s(x)}
  
  def executor():
      yield from aio.wait(futures, return_when=aio.FIRST_COMPLETED)
  
  done, pending = executor()
  </code></pre>
  
  <p>But it doesnt work for some unknown reason.</p>