Skip to content
Opensource internals
  • Posts

Python

CPython's LazyImport Implementation in C

Oct 20, 2026 10 min read Jay Hubbert

Lazy imports work by parking a proxy object in the namespace and atomically replacing it with the real module the first time the name is touched.

PythonCpythonInternalsLazy importImport

Read more →

CPython's list Implementation in C

Oct 20, 2026 7 min read Jay Hubbert

CPython’s list is a contiguous array of pointers with a separate size and capacity, growing by about an eighth each time so appends stay O(1) amortized.

PythonCpythonInternalsList

Read more →

CPython's memoryview Implementation in C

Oct 20, 2026 9 min read Jay Hubbert

CPython splits memoryview into a shared managed-buffer snapshot and a per-view copy of shape/strides, so slicing adjusts pointers instead of copying data.

PythonCpythonInternalsMemoryviewBuffer protocol

Read more →

CPython's Module Implementation in C

Oct 20, 2026 8 min read Jay Hubbert

Every Python module is, at the C level, an instance of PyModule_Type. Unlike bool or int, a module is a mutable object whose “attributes” are just the entries of its dictionary. …

PythonCpythonInternalsModule

Read more →

CPython's NoneType Implementation in C (None)

Oct 20, 2026 6 min read Jay Hubbert

None is Python’s “no value” sentinel. There is exactly one instance of NoneType, it is immortal, it has no methods, and comparing it is just pointer equality. In CPython all of …

PythonCpythonInternalsNonetypeNone

Read more →

← Newer Page 5 of 11 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·