What this code in dictobject.c does?

Again…, what “slow down” mean? Since it is just an additonal implementation and doesn’t share the implementation with dict, we can not use the fast path in the dict_merge. There are no slowdown here. How the basedict help it?

Naoki, please, or I code or I respond to you… anyway:

what “slow down” mean?

Try for example to re-implement dict using abc.MutableMapping and bench it :smiley:

How the basedict help it?

First of all, you have not to do all the things I already mentioned. Furthermore, IMHO the dict iter implementation (and also the dict views) should be more generic (this is also said by BDFL in a comment…) and have a dedicated .h and .c files… I mean, dictobject.c have ~4’700 rows o__0

This way, another dict-like object can use a more generic dict_iter implementation, and you can check against it.

Oh, didn’t you mean implementing dict-like in C and register it to ABC?
I never thought you are talking about implementing dict using abc.MutableMapping.
I am always confused about what you are saying…

Since you never show elaborate example, I gave up on understanding your idea. I will wait for your implementation. C is much easier than English.

3 Likes