Name: Anonymous 2012-02-04 15:51
I don't understand how a list works in Python.
I always assumed that it was just a linked list with the "link" part hidden to make it mutable. If I wanted to delete a value or a slice I assumed it would just mark the deleted parts for the GC and route the "links" around them.
x = [1,2,3,4,5]
x[0] = (1, 0x1111)
x[1] = (2, 0x2222)
x[2] = (3, 0x3333)
del x[1]
x[0] = (1, 0x1111)
x[1] = (3, 0x3333)
Is this how it works?
I always assumed that it was just a linked list with the "link" part hidden to make it mutable. If I wanted to delete a value or a slice I assumed it would just mark the deleted parts for the GC and route the "links" around them.
x = [1,2,3,4,5]
x[0] = (1, 0x1111)
x[1] = (2, 0x2222)
x[2] = (3, 0x3333)
del x[1]
x[0] = (1, 0x1111)
x[1] = (3, 0x3333)
Is this how it works?