Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- async def test_1(a, b, c):
- await a
- await b
- await c
- async def test_2():
- await asyncio.sleep(10)
- await asyncio.sleep(10)
- await asyncio.sleep(10)
- async def test_3(a):
- print("1")
- await asyncio.sleep(11)
- print("2")
- a.cancel()
- async def main():
- # e = asyncio.ensure_future(test_1(asyncio.sleep(10), asyncio.sleep(10), asyncio.sleep(10)))
- f = asyncio.ensure_future(test_2())
- # g = asyncio.ensure_future(test_3(e))
- d = asyncio.ensure_future(test_3(f))
- # await asyncio.wait([e, f, g, d])
- await asyncio.wait([f, d])
- loop = asyncio.get_event_loop()
- loop.run_until_complete(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement