So, we know that Python uses a reference system, in order to refer to values in a list. So, if we create a new variable=list[index], the variable points to that list index. But what about when we are slicing a new list? Does the new sliced list use pointers? Or is it a new list in itself?
1 Answer
A list in Python is made of an array of references (plus some bookkeeping data). Slicing allocates a new array, but those copied references still point to the same heap objects.
When you do variable=list[index], the variable does not point to the list index. Rather, it references the same object that the list does at that index (at the time it is looked up; they can be changed independently later).
memoryviewfor lists. some good info: Buffer Protocol, and here