Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts/python-dictionary-implementation/ #3

Open
utterances-bot opened this issue Sep 6, 2022 · 1 comment
Open

posts/python-dictionary-implementation/ #3

utterances-bot opened this issue Sep 6, 2022 · 1 comment

Comments

@utterances-bot
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@utterances-bot and others