Do You Know What a Variable Is? Do You Really?
Everyone knows what a variable is until 300 is 300 returns False.
Something is going on under the hood that (hopefully) most Python developers never question. This talk pulls back the curtain on how CPython actually represents your everyday int, why the rules seem to bend at certain thresholds, and what any of this has to do with idle games throwing around numbers bigger than the atoms in the universe.
For a long time, I've been obsessed with idle incremental games. Have you ever wondered how they manage to do math on numbers that big?
That obsession sent me down a rabbit hole into how Python and CPython actually handle numbers under the hood.
You want to know how deep the rabbit hole goes? Follow me, and we'll dig into:
- Why two variables holding the exact same value aren't always "the same."
- What CPython is really doing when you write a = 5, beyond "storing a value in a box."
- Why 2**100_000 doesn't crash, overflow, or lie to you, and why C can't say the same.
- Does "arbitrary precision" really mean arbitrary?
- The trick that lets a mobile idle game display numbers with more digits than AI engineers on LinkedIn, and why Python's "unlimited" integers alone can't get you there.
Lead Data Engineer with 7 years of experience working in the data universe.