Is Python list essentially a linked-list implementation? -
this question has reply here:
how python's list implemented? 6 answerswondering can infer below statements?
>>> li=['a', 'b'] >>> id(li) 4300601032 >>> li.insert(0,'z') >>> li ['z', 'a', 'b'] >>> id(li) 4300601032 is original list object copied before inserting 'z' or work linked-list?
as documented:
list , bytearray objects back upwards additional operations allow in-place modification of object.
insert listed 1 of operations. no re-create made, , insert modifies list object in place.
note has no bearing on how lists implemented. whether lists implemented linked lists not part of specified documentation. specified various operations do, not how done.
python list memory
No comments:
Post a Comment