Slide 14
Slide 14 text
'VUVSFT
§ .BLF'VUVSF GSPNDPSPVUJOFT
improt asyncio
async def identity(value):
return value
future1 = asyncio.ensure_future(identity(1))
future2 = asyncio.ensure_future(identity(2))
future3 = asyncio.gather(future1, future2)
loop = asyncio.get_event_loop()
print(loop.run_until_complete(future3))
#=> [1, 2]