O'Reilly logo
  • You Wang thinks this is interesting:

The underlying implementation of Python’s list type is a bit different. Instead of several separate nodes referencing each other, a list is basically a single, contiguous slab of memory—what is usually known as an array. This leads to some important differences from linked lists. For example, while iterating over the contents of the list is equally efficient for both kinds (except for some overhead in the linked list), directly accessing an element at a given index is much more efficient in an array.


Cover of Python Algorithms: Mastering Basic Algorithms in the Python Language, Second Edition


Python maintains an array of references for fast indexing. List just stores references to objects on the heap. So the size of each element in list is the same.