Making The Case For A (Semi) Formal Specification Of CPython


November 9th, 2020

36 mins 41 secs

Your Hosts

About this Episode


The CPython implementation has grown and evolved significantly over the past ~25 years. In that time there have been many other projects to create compatible runtimes for your Python code. One of the challenges for these other projects is the lack of a fully documented specification of how and why everything works the way that it does. In the most recent Python language summit Mark Shannon proposed implementing a formal specification for CPython, and in this episode he shares his reasoning for why that would be helpful and what is involved in making it a reality.


  • Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
  • When you’re ready to launch your next app or want to try a project you hear about on the show, you’ll need somewhere to deploy it, so take a look at our friends over at Linode. With the launch of their managed Kubernetes platform it’s easy to get started with the next generation of deployment and scaling, powered by the battle tested Linode platform, including simple pricing, node balancers, 40Gbit networking, dedicated CPU and GPU instances, and worldwide data centers. Go to and get a $100 credit to try out a Kubernetes cluster of your own. And don’t forget to thank them for their continued support of this show!
  • Do you want to get better at Python? Now is an excellent time to take an online course. Whether you’re just learning Python or you’re looking for deep dives on topics like APIs, memory mangement, async and await, and more, our friends at Talk Python Training have a top-notch course for you. If you’re just getting started, be sure to check out the Python for Absolute Beginners course. It’s like the first year of computer science that you never took compressed into 10 fun hours of Python coding and problem solving. Go to today and get 10% off the course that will help you find your next level. That’s, and don’t forget to thank them for supporting the show.
  • Your host as usual is Tobias Macey and today I’m interviewing Mark Shannon about his efforts to create a formal specification for the CPython interpreter


  • Introductions
  • How did you get introduced to Python?
  • Can you start by describing the current state of how the Python language and the CPython runtime are defined?
  • What is your motivation in advocating for a specification?
    • After ~25 years of the language, why is now the time to pursue this effort?
    • How does the history of the language and the scope of the ecosystem and community impact the effort required to make this a reality?
  • What is involved in creating the specification and where would it be located once complete?
    • What are some examples of languages that are formally specified?
  • What are the possible benefits of creating a specification for the CPython virtual machine?
    • What is the distinction between a specification for the VM as opposed to a specification for the language?
  • What are some potential downsides to having a (semi-)formal specification become part of the definition of the interpreter?
  • Can you describe the process of doing the work to create the specification?
  • How are you approaching the actual definition of the specification (e.g. prose vs programmatic)?
    • What are the tradeoffs of prose vs. an executable specification (e.g. TLA+, Alloy)?
  • How does this work tie into your goals of improving the speed of the CPython interpreter?
  • What are some of the most interesting, unexpected, or challenging aspects of your efforts to bring this specification to CPython?
  • How can the community contribute to this effort?

Keep In Touch


Closing Announcements

  • Thank you for listening! Don’t forget to check out our other show, the Data Engineering Podcast for the latest on modern data management.
  • Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
  • If you’ve learned something or tried out a project from the show then tell us about it! Email with your story.
  • To help other people find the show please leave a review on iTunes and tell your friends and co-workers
  • Join the community in the new Zulip chat workspace at


The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA