How to create list by size without init or default init in Python?
I mean, I want the list to be created with garbage information, so that the creation of list would be fast.
Just like when I declare an array in C
int a[50];
Then when I try to access a[3]
directly, it will return garbage information because I haven't initialize it.
Even if I do things like
[None] * length
It still takes about same time as
[3] * length
As I have tested it with length = 10^9.
But in C, these two ways are quite different. The latter one is a "memset", whereas the declaration just allocates the memory without initialization.