I'm running this code in Python 3.7.3
import asyncio
async def fun(time):
    print(f"will wait for {time}")
    await asyncio.sleep(time)
    print(f"done waiting for {time}")
async def async_cenas():
    t1 = asyncio.create_task(fun(1))
    print("after 1")
    t2 = asyncio.create_task(fun(2))
    print("after 2")
def main():
    t1 = asyncio.run(async_cenas())
    print("ok main")
    print(t1)
if __name__ == '__main__':
    main()
    print("finished __name__")
And getting this output:
after 1
after 2
will wait for 1
will wait for 2
ok main
None
finished __name__
I was expecting to see also:
done waiting for 1
done waiting for 2
I.e., why was expecting asyncio.run(X) would wait for the coroutines to complete before proceeding.
 
    