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 most of everyday code you won't need such optimization.
However, when list efficiency becomes an issue, the first thing you should do is replace generic list with typed one from array module which is much more efficient.
Here's how list of 4 million floating point numbers cound be created:
import array
lst = array.array('f', [0.0]*4000*1000)