I have two StreamReader and you want to read them in a loop. I use asyncio.wait as follows:
done, pending = await asyncio.wait( [reader.read(1000), freader.read(1000)], return_when=asyncio.FIRST_COMPLETED)
Now done.pop() gives me a future that ended first. The problem is that I donβt know how to find which read() operation completed. I tried to put [reader.read(1000), freader.read(1000)] in the tasks variable and compare the future with this. But this seems wrong, since the future made is not equal to any of the initial tasks. So how should I find which coroutine is complete?
source share