How is Python's List Implemented?

后端 未结 9 874
野趣味
野趣味 2020-11-22 08:00

Is it a linked list, an array? I searched around and only found people guessing. My C knowledge isn\'t good enough to look at the source code.

9条回答
  •  萌比男神i
    2020-11-22 08:36

    In CPython list is implemented as dynamic array, and therefore when we append at that time not only one macro is added but some more space is allocated so that everytime new space should not be added.

提交回复
热议问题