[Tutor] array module

Manprit Singh manpritsinghece at gmail.com
Mon Oct 11 22:43:09 EDT 2021


Dear Sir,
While doing some experiments with array module in python standard library ,
which are given below :
lst = list(range(100))

import array
arr = array.array("h", range(100))

sys.getsizeof(lst)
returns 856

sys.getsizeof(arr)
returns 268

Shows that the list lst and array arr both are having same data, but there
is huge difference in size bytes.  so for storing homogenous 1 D data
arrays are more good ,  Why they are not widely used ?
What are the specific use cases of this array module ?

Regards
Manprit Singh


More information about the Tutor mailing list