Message32207
>>> class MyDict(dict):
... def keys(self): print "keys"
... def __getitem__(self, n): print "__getitem__"
...
>>> myDict = MyDict(a=1, b=2)
>>> dict(myDict)
{'a': 1, 'b': 2}
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:
if type(d).__getitem__ is dict.__getitem__ and type(d).keys is dict.keys:
...okay to access items directly...
else:
...go through the methods...
|
|
Date |
User |
Action |
Args |
2007-08-23 14:54:34 | admin | link | issue1730480 messages |
2007-08-23 14:54:34 | admin | create | |
|