-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Python Dictionary Implementation · KK's Blog (fromkk)
Overview CPython allocation memory to save dictionary, the initial table size is 8, entries are saved as <hash,key,value> in each slot(The slot content changed after Python 3.6). When a new key is added, python use i = hash(key) & mask where mask=table_size-1 to calculate which slot it should be placed. If the slot is occupied, CPython using a probing algorithm to find the empty slot to store new item.
https://www.fromkk.com/posts/python-dictionary-implementation/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels