Making Python C-like

Arpit Bhayani (~arpit71)


We explore the internals of Python and alter its evaluation strategy.

Chained comparison operators "a < b < c", in Python, are evaluated like they are evaluated in Mathematics. So doing "a < b < c" answers if b likes between a and c. In this talk I give a walkthrough on what it takes to alter this strategy and make it C-like.

Here's the outline:

  • Introduction (2 minutes)
  • Evaluation strategies Math-like and C-like (2 minutes)
  • Disassembling and Execution Walkthrough (6 minutes)
  • How Python's evaluation strategy is Math-like (2 minutes)
  • What we need to make it C-like (4 minutes)
  • Altering the source code (2 minutes)
  • Disassembling and Execution Walkthrough (3 minutes)
  • Takeaways and Conclusion (3 minutes)
  • Questions (6 minutes)


Basic working knowledge of Python would be good to have.

Video URL:

Content URLs:

Here's me explaining this:

A detailed writeup about this:


Speaker Info:

I tweak CPython for fun and try to understand how it works. I am working as Sr. Engineering Manager - SRE at Unacademy. Prior to this worked at Amazon and Practo. I run a CS Engineering focussed newsletter where I write and share an essay about programming languages internals, deep dives on some super-clever algorithms, and few tips on building scalable distributed systems. The newsletter currently has close to 1200+ subscribers.

Speaker Links:


Essays and Blogs:

YouTube Channel:

LinkedIn Profile:

Section: Core Python
Type: Talks
Target Audience: Intermediate
Last Updated: