In the array
library in Python, what's the most efficient way to preallocate with zeros (for example for an array size that barely fits into memory)?
Creating a huge list first would partially defeat the purpose of choosing the array
library over lists for efficiency.
Is it possible to preallocate even faster, without spending time on overwriting whatever there was in memory?
(Preallocating is important, because then the code is faster than growing an array iteratively, as discussed here.)