Sobes.tech
Middle+

How is the constant size of memory cells for all list elements achieved if data types in the list can be different?

sobes.tech AI

Answer from AI

Python lists store references to objects, not the objects themselves. The size of a reference is the same for all objects (usually 8 bytes on 64-bit systems), regardless of the type or size of the object it points to. Thus, list elements have a uniform memory cell size, as they store not the data itself, but pointers to the data.

How is the constant size of memory cells for all list… - sobes.tech