You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dict init/update accesses internal items of dict derivative #45034
PyDict_Merge accesses the items of the dict to be merged directly rather than going through the interface for any dict instance--even a dict derivative--by virtue of using PyDict_Check rather than PyDict_CheckExact. I believe the logic needs to be:
It is documented that access to special methods is more direct than normal path. This is not going to change. A similar example was discussed on python-list earlier this year with the above conclusion.
I concur with Terry.
This is just a fact of life when subclassing builtins.
The objects are "open-for-extension, closed-for-modification".
If you want more direct control use UserDict.
Activity
blakeross commentedon Jun 4, 2007
PyDict_Merge accesses the items of the dict to be merged directly rather than going through the interface for any dict instance--even a dict derivative--by virtue of using PyDict_Check rather than PyDict_CheckExact. I believe the logic needs to be:
devdanzin commentedon Apr 6, 2009
IIRC, the same behavior is present for subclasses of other builtin types.
terryjreedy commentedon Aug 9, 2010
It is documented that access to special methods is more direct than normal path. This is not going to change. A similar example was discussed on python-list earlier this year with the above conclusion.
rhettinger commentedon Aug 11, 2010
I concur with Terry.
This is just a fact of life when subclassing builtins.
The objects are "open-for-extension, closed-for-modification".
If you want more direct control use UserDict.