Playback speed
Share post
Share post at current time

CPython Type System Internals: Video Series

A series of videos of me taking you through the CPython source code to explain its type system design & implementation

I’ve been writing Confessions of a Code Addict for the last eight months. During this time I have covered a wide array of topics, including AI, data structures, hardware, math, algorithms, and Python internals.

Whenever I write about the internals of CPython, I usually get asked about making videos of me walking through the code. I kept stalling it because making videos is a monumental amount of work, where writing is just one component of it. But when I published my article on how does CPython execute “a+b”, Andrej Karpathy liked and said he would be interested in a video version of it.

Now, when the OG himself asked for a video version, I had to act on it.

Why CPython Type System Internals?

I’m starting this by taking you through the internals of the CPython type system. Even though I wanted to cover the article about how “a+b” executes in CPython, but I did not realize how much information I packed in that single article. When I tried to record it, it was more than an hour long and I was still not finished. Therefore, I am breaking it up and starting by first covering just the type system.

The type system really forms the bottom most layer of CPython runtime implementation, so starting from there, we can cover other more interesting parts in future series.


Now, even the type system is a largish topic in itself, so I have broken it down into multiple bite-sized parts, which I am linking below.

  1. Design of the CPython Type System

  2. Emulating Inheritance and Polymorphism in C

  3. Decoding PyObject and PyTypeObject in CPython

  4. Implementation of the Float Built-in Type in CPython

Wrapping Up

I am glad I made these videos, I hope you have fun watching them. I have to admit that even if you know your material, the amount of work behind making videos is monumental. Hats off to the folks who regularly produce high quality videos on complex topics.

If you have any suggestions, or questions, feel free to reply in comments, or reach out to me on Twitter/X.

Holiday Break

I wish you all a happy and cheerful holiday season. I will be taking a few days off as well during these days. So, I will send out the next post after the break, in the new year. :)

Support Confessions of a Code Addict

Finally, I would like conclude by making a small appeal to you. I’ve been working on Confessions of a Code Addict full time which has allowed me to give my 100% to everything I produced. If you enjoy these pieces, and find them valuable then please consider supporting me by becoming a paid subscriber or buying me a coffee.

Note that the pricing will show to you in Indian Rupees (INR). The monthly plan is priced at INR 550 ($6.60) and the annual plan is priced at INR 4999 ($60). If you work in a tech company, you may be able to expense it as part of your learning budget as well.


Confessions of a Code Addict
Confessions of a Code Addict Podcast
Deep dives into varied topics on Computer Science including compilers, programming languages, database internals, AI and more. Subscribe for insights and advance your engineering skills!