How I decided to make a series of videos about the CPython interpreter
And decided to make my own! Under the cut I will tell you how I make “The Best Python Course”* on YouTube. Why it is free. And why it is the way it is. And I will also tell you what benefit developers will get from watching it.
* “The best Python course” according to CPython core developers in Russia :trollface:
Format
It must be said that recently there has been a lot of educational content on the Internet. Usually, it is not of very high quality. Even on YouTube, videos like “Python in 5 hours”, “How to raise your salary?” or another election of another framework for a web developer pop up every day. Perhaps, this can be useful to someone. However, deeper technical content is being washed out of the public sphere. Which for me, as a big fan of learning more about the details of the device of this or that technology, is quite sad.
Plus, quite a lot of content focuses purely on practice: “how to solve the problem Ч or Ц?” Which is, of course, much more useful, but still does not give the opportunity to quench your thirst for knowledge.
Well, and the most important thing: almost all existing courses are for complete beginners. If you want to level up from a junior level, then you are on your own. Search, read, watch. Maybe the company will help. If you are lucky.
With this background in mind, I began to create my concept.
What happened?
First, I decided to leave the question of “practical applicability” out of the equation. Whether it is possible to apply bytecode instruction optimization in CPython somewhere in practice is up to everyone to decide for themselves. The question is, of course, controversial. Many people write in the comments: “Why should I know how CPython works? float
“? The answer is very simple: knowledge of the insides allows you to make more reliable, simple and correct decisions.
Next: each video is built around one narrow topic and examines it from all sides. For example: in the video about float
there is about tokenizer and about C structure PyFloatObject
and about the issues of accuracy and applicability of this object.
Well, and the most unusual thing: I decided to make each video divided into three parts by difficulty level. For juniors, middles and seniors. For example: in the video about +
(yes, about the plus) at the junior level we repeat the story with __add__
, __radd__
And NotImplemented
. At the middle level we are already talking about more complex things: atomicity __iadd__
how does the priority of operations work through the definition of PEG grammar and ast
for addition. Well, at the level for comrades tomatoes we talk about: optimization of addition bytecode, typeslots for addition of numbers and collections.
This approach allows you to talk about the same thing from different angles, which I really like, and allows you to show many parts of CPython.
Well, and I can't help but mention the interview format. I can't cover all the topics in detail and fully on my own. For example: I don't know the history of the IEEE-754 standard very well (given the number of versions and updates of this standard). But it was necessary to talk about it. I realized that I needed help. And I invited a member of the IEEE floating-point standardization working group for an interview about the history and future of this standard.
I have already been visited by:
Mark Dickinson (https://github.com/mdickinson) – CPython core developer with a practical interest in numbers
Michael Overton (https://cs.nyu.edu/~overton/) is the author of a book about IEEE-754 and a member of the IEEE Floating-Point Standardization Working Group.
Alex Waygood (https://github.com/AlexWaygood) – core developer of CPython, typeshed and ruff
And of course, all materials (plus additional links and practical tasks) are in the repository on GitHub: https://github.com/sobolevn/the-best-python-course
The most important question for many. Why free? It seems that such a format is the only possible one: to attract famous people to participate in it. And to attract the audience to the videos themselves. Well, and I naively believe that knowledge should be available to everyone 🙂
Future plans
There are so many plans! So much to tell about! About the structure of lines and plans to switch to utf-8 internally PyUnicodeObject
in new versions of python. About functions, PyCodeObject
tp_fastcall, PyFrameObject
closures. About symtable
and different types of “variables”. About classes and OOP (video 3 or 4 will be required). About different allocators and the features of their work in the mode nogil
. And as for typing
there's so much to tell, wow!
In total, I plan to make about 50 videos. Maybe more.
To cover complex topics, I will continue to invite interesting guests who had a hand in creating the technology from the topic of the video. It is much easier than doing everything yourself. And people may find it more interesting.
Conclusion
If you have Python developers in your company, and if you want to deepen their knowledge, then feel free to send them a link to the entire playlist: https://www.youtube.com/playlist?list=PLbr8rVGhPD0WQgO97Ao67Q-QVuSbm_Zpz
I hope people will find it useful and interesting!