Grokking Concurrency in Python
0% completed
Build an Event Loop
0.000 s page 0: request sent 0.000 s page 1: request sent 0.000 s page 2: request sent 0.251 s page 1: reply complete, 137,039 bytes in 3 reads
Those lines come from a Python program with exactly one thread. Within the same millisecond it sent three requests to Harvest's test site, and a quarter of a second later the replies came back together. It uses no thread pool, no asyncio, and only the standard library. The central part is a loop of fifteen lines.
That loop is an event loop, the same kind of scheduler that asyncio runs underneath every async def function
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%