array.array

Python's standard-library typed array, which stores numbers of one type as raw binary values instead of as full Python objects.

In more detail

You choose the element type with a one-letter typecode; 'i' means a signed integer stored in four bytes. Because it holds raw values rather than pointers to objects, it uses several times less memory than a list of the same numbers. It only holds that one numeric type, so it is not a general-purpose container.

Example

array('i', range(100))

Related terms

Taught in

References