记录
from asyncio import get_event_loop, wrap_future, wait_for
f = Future()
async def foo():
# 注意这里的用法
a = await wait_for(wrap_future(f), timeout=None)
# a = await f # TypeError: object Future can't be used in 'await' expression
print(a)
async def set_result():
f.set_result('hello')
loop = get_event_loop()
loop.run_until_complete(set_result())
loop.run_until_complete(foo())