When programming in Python, is it possible to reserve memory for a list that will be populated with a known number of items, so that the list will not be reallocated several
In Python, all objects are allocated on the heap.
But Python uses a special memory allocator so malloc won't be called every time you need a new object.
There are also some optimizations for small integers (and the like) which are cached; however, which types, and how, is implementation dependent.