3 ms·
They're pretty close. They provide random access, are backed by contiguous memory, and the syntax behind their use is similar to arrays in other languages.
by scott_s 13y ago
They're pretty close. They provide random access, are backed by contiguous memory, and the syntax behind their use is similar to arrays in other languages.
- akx 13y agoPython lists are backed by contiguous memory of pointers to other objects, mind.
- ithkuil 13y agoThat's because there aren't unboxed primitive values in the language. Even a local integer variable contains a pointer to the integer. This is orthogonal to whether a container is a list or an array though.
- scott_s 13y agoYes, lists in Python are going to be implemented in C as arrays of PyObject pointers. Which is why numpy has their own arrays - they want arrays of int32, float64, etc.