Skip to content
Opensource internals
  • Posts

Range

CPython's range Implementation in C: Lazy Sequences That Never Materialize

Oct 20, 2026 6 min read Jay Hubbert

range holds four PyObject pointers and nothing else — the numbers are computed on demand, so range(10**18) costs the same as range(3).

PythonCpythonInternalsRange

Read more →

PostgreSQL's Multirange Type Implementation in C

Aug 31, 2026 6 min read Jay Hubbert

A multirange is what you get when you let a range type hold more than one range: int4multirange can be {[1,5),[10,20)}. The surprising thing is how little C there is to it. All six …

PostgresInternalsMultirangeRange

Read more →

PostgreSQL's Range Type Implementation in C

Aug 13, 2026 9 min read Jay Hubbert

A range type is one of PostgreSQL’s stranger storage formats. It is a variable-length value, but its first four bytes are not a payload — they are the length of the whole thing, …

PostgresInternalsRangeInt4rangeDaterange

Read more →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·