python-features
How Lists Compile
List creation, indexing, append, and iteration.
Published May 30, 2026
Creation
[a, b, c] allocates a list and fills it inline.
Indexing
list[i] uses fast bounds-checked access.
Append
list.append(x) amortised growth with over-allocation.
Comprehension
[x for x in data] compiles to a pre-allocated loop.