Tushar Sadhwani

Tushar Sadhwani

How big can python integers *really* get

Ran#pyconjp_4IntermediateEN
11:15 - 11:4530min
DAY 1
09/26
FRI

You might know that Python doesn't have a max integer size. Unlike most other languages that are limited to having a 64 bit integer type, Python has a "theoretically infinite" maximum integer.

But, is that true?

Turns out no, Pythondoes have a maximum integer size. We'll look onto Python's source code and figure out how it stores and works with integer values.


Description

We'll be covering the following topics:

  • Python integers, and how they're different from all other languages (5 min)
  • How they are implemented in C (3 min)
  • What's truly the largest number that Python integers can store? (7 min)
  • How does Python efficiently do math with these integers? (10 min)
  • Q&A (5 min)

Motivation

Python's source code in C is still a black box to many, and it's really easy to never think about how the language itself works. But knowing where to look in the C code can be a huge help in your Python journey, so I hope to provide insight into the C source code.


Key Takeaways

  • An introduction to the CPython codebase
  • Basics of Python data types in C

Prerequisites

Understanding Python and C fundamentals would be required to be able to follow this talk.

Tushar Sadhwani

Tushar Sadhwani

Profile

Long term Python dev, likes to work on open source software and Python developer tooling.