CPython internals: A ten-hour codewalk through the Python interpreter source codeOctober 2014 (assistant professor)
Summary
Here are nine lectures walking through the internals of CPython, the canonical Python interpreter implemented in C. They were from a dynamic programming languages course that I taught in Fall 2014 at the University of Rochester. The format isn't ideal, but I haven't seen this level of detail about CPython presented online, so I wanted to share these videos.
Here are nine lectures I gave on CPython internals as part of my course on dynamic programming languages in Fall 2014. These videos are meant as a reference, not as a shining exemplar of pedagogy. If I had infinitely more time, I would edit these videos into 5- to 10-minute chunks and link them to the corresponding source code. More importantly, I would've gone back in time and planned my lectures to maximize “video chunkability” ... and used a real microphone ... and added in-situ quiz questions ... and made them more interactive. But in the spirit of CRAPL, I just recorded my lectures using Camtasia on an MS Surface Pro 3 tablet and put up the unedited raw videos. If you want a polished introduction to the high-level ideas behind CPython, I highly recommend watching Allison Kaptur's PyCon 2015 talk on Byterun. The purpose of these lectures is to give a technical overview of the core components of CPython. Although it does not strive to be comprehensive, once you understand these lectures, you should be able to understand the rest of the CPython code base. If you want to follow along with the code walkthroughs, download and unzip the Python 2.7.8 source code. And to see the accompanying homework assignments, visit the course webpage. Listen to a one-hour podcast describing this course: Lecture 1 - Interpreter and source code overviewLecture 2 - Opcodes and main interpreter loopNote: There is a bug in this lecture regarding the This lecture references:
Lecture 3 - Frames, function calls, and scope
Lecture 4 - PyObject: The core Python object
Lecture 5 - Example Python data types
Lecture 6 - Code objects, function objects, and closures
Lecture 7 - Iterators
Lecture 8 - User-defined classes and objects
Lecture 9 - Generators
Created: 2014-10-08
Last modified: 2015-05-31 |