Deconstructing Python `int`'s Internal Structure

Every Python `int` is a full-fledged object, comprising a reference count (`ob_refcnt`), a type pointer (`ob_type`), and the actual value data, which together contribute to its larger memory footprint. For larger integers, an additional `ob_size` field tracks the number of 'digits' used for the value.

Sources

Open the full topic