I'd like to write my own dict
container like the built-in dict
but with a different hash function and collision resolution strategy.
PyDictObject
, as Include\cpython\dictobject.h
defines it, doesn't require change, but I'd like to write a different version of _Py_dict_lookup
compared to the code in Objects\dictobject.c
. (I'm referring to files in the CPython repository.)
What's a (simple) way to be able to change/add new files so that after rebuilding the interpreter, I can have
a = dict('key'='value')
b = my_dict('key2'='value2')
run successfully such that my_dict
has a different hash table implementation (written in C, like dict
does)?