What type of data structure is a python list?

What is the typical underlying data structure used to implement Python's built-in list data type?

Bakuriu

94.2k21 gold badges186 silver badges222 bronze badges

asked May 27, 2009 at 6:22

5

CPython:

typedef struct {
    PyObject_VAR_HEAD
    /* Vector of pointers to list elements.  list[0] is ob_item[0], etc. */
    PyObject **ob_item;

    /* ob_item contains space for 'allocated' elements.  The number
     * currently in use is ob_size.
     * Invariants:
     *     0 

Chủ Đề