Base list structure, tuple, dict

I would like to get some idea of ​​how data types are implemented in python-list, tuple, dict and set

As they are implemented, it is important to use a data structure. Any place / url to figure it out exactly?

+6
source share
1 answer

The best place to look is CPython implementation source code :

  • dict - Fast key resolution hash map
  • list - looks like an array of PyObject s
  • tuple - Same as a list, but with optimization that the tuple can resolve (fixed size, objects)
  • set - Hash map with optimization for cache localization

The source code is heavily commented and well written by C This would be the best place to understand the data structures used in detail.

+6
source

All Articles