I came from C
world where the size of buffers can be controlled in advance. For instance, declaring a buffer of doubles that holds 10 elements, we do:
double *buffer = calloc(10, sizeof(double));
In Python, it is quite the contrary in the sense that we don't need to worry about the details and the size of the buffer by saying buffer=[]
.
My question is: If I want to restrict a python list to hold an arbitrary number of values, say 10 doubles, how can we do that with default python lists or maybe numpy
?