I would like to get some understanding on how the data types in python - list, tuple, dict and set - are implemented
How are they implemented, importantly the data structure used. Any place/ url to precisely get this understanding?
I would like to get some understanding on how the data types in python - list, tuple, dict and set - are implemented
How are they implemented, importantly the data structure used. Any place/ url to precisely get this understanding?
The best place to look is the CPython
implementation source code:
dict
- Hash map targeting fast resolution of keyslist
- Looks like an array of PyObject
stuple
- Same as list but with optimisations that a tuple can allow (fixed size, objects)set
- Hash map with optimisations for cache localityThe source code is heavily commented and well written C
. This would be the best place to understand the data structures used in detail.