Coding Experiment: Asynchronous Event Loop

Last night, at the RC Job Fair, a python engineer suggested a good way to better understand event loops is to write one yourself. It sounded interesting, and I felt like I understood the gist of the idea.

I once heard that to really understand something in programming, you need a grasp on what’s happening one level of abstraction deeper. So if you want to understand the HTTP protocol, it helps to learn a bit about TCP sockets, and I guess if you want to learn about asyncio or some other single-threaded coroutine-centric library, you want to learn about event loops.

So I went and made one myself today, and got a little more familiar with python generators and what presumably goes on under the hood for Python libs like asyncio and twisted.

Here it is. Enjoy!

Like what you read? Give Kimberly McCarty a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.