CPython's range Implementation in C: Lazy Sequences That Never Materialize
range holds four PyObject pointers and nothing else — the numbers are computed on demand, so range(10**18) costs the same as range(3).
range holds four PyObject pointers and nothing else — the numbers are computed on demand, so range(10**18) costs the same as range(3).
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 …
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, …