Grokking Concurrency in Python
Vote

0% completed

​

Starting and Running a Loop

A program that starts with asyncio.run(main()) gets a fresh event loop, runs main to the end on it, and has the loop closed when the call returns. A task that main started but did not await is cancelled if it is still running when main returns. Nothing tied to the loop, such as an open connection, survives into a second asyncio.run call.

Older ways of starting a loop now fail. Calling asyncio.get_event_loop() from ordinary code used to create a loop when none existed, and much example code still starts with it. Since Python 3.14 the call raises RuntimeError instead.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content