Marco Sulla wrote at 2021-12-29 09:29 +0100: >On second thought, I think I'll do this for the pure py version. But I >will definitely not do this for the C extension
Are you sure you need to implement your type in C at all? I made a small `timeit` test: ``` >>> class cd(dict): pass ... >>> timeit("d[1]", "d={1:1}", globals=globals()) 0.02474160000019765 >>> timeit("d[1]", "d=cd({1:1})", globals=globals()) 0.08281239100051607 ``` This means that for the above trivial case, access is 3.5 times slower (the difference is smaller for more complex cases when hashing becomes more expensive) but it is still only 83 ns per access. Thus, if your application is not highly dominated by dict accesses, the overall difference will not be large. -- https://mail.python.org/mailman/listinfo/python-list