I’m using asyncio and I’d like to add an item to an object that others 
can wait on immediately and which eventually I will want to use to track a 
coroutine. In other words I want something like:

class Info:
def __init__(self):
self.done_task = asyncio.Future()

info = Info()
# do other stuff, but eventually
coro = ...
asyncio.connect_future(coro, info.done_task)

I can certainly live without this, it simply requires adding an additional 
task made with asyncio.ensure_future and using that to set the result of 
done_task.

But it would be a lot more elegant to just have the one future (especially if 
I have to cancel the wait, as I have to keep the extra task around so I can 
cancel it). So...just wondering if I missed something.

Regards,

Russell


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to