Am 20.09.2010 13:11, schrieb Steven D'Aprano: > I have a dict subclass that associates extra data with each value of the > key/value items: [...] > How can I fix this?
Since the dict class is crucial to the overall performance of Python, the dict class behaves bit different than other classes. I don't know if this is documented somewhere. Dict methods call the PyDict_GetItem function directly instead of going through the type's struct. You have two options to get the desired behavior. Either implement all functions that call the methods you want to overwrite, or subclass from something like DictMixin or the appropriate ABC. Christian -- http://mail.python.org/mailman/listinfo/python-list