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 9 min read Jay Hubbert

A Python module is a PyModuleObject with a dict as its namespace, plus optional per-module C state — and its tp_getattro is where lazy imports get resolved.

PythonCpythonInternalsModule

Read more →

CPython's NoneType Implementation in C (None)

Oct 20, 2026 7 min read Jay Hubbert

None is a single static immortal PyObject: no allocation, no refcounting, and identity comparison — plus a dedicated stack-ref encoding for the eval loop.

PythonCpythonInternalsNonetypeNone

Read more →

← Newer Page 5 of 11 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·