Message340306
@Serhiy
> It the pure Python implementation PyDict_GetItem also
> returns value, not node of linked list.
I missed pure Python implementation used two dicts.
@Eric
> Please don't miss the fact that the main reason for mirroring the dict table is to get O(1) node lookup (in the linked list).
I don't miss it, of course. I'm proposing make linked list node as Python Object, and store it directly into dict, like LRU implementation in _functools.
In this idea, if dict.__getitem__ is called directly, a node of linked list is returned instead of value in the node.
I must admit this idea is too aggressive.
If we can redesign OrderedDict from scratch, I propose OrderedDict uses dict, without inheriting it. But it is too late. |
|
Date |
User |
Action |
Args |
2019-04-15 23:11:52 | methane | set | recipients:
+ methane, tim.peters, rhettinger, eric.snow, serhiy.storchaka |
2019-04-15 23:11:52 | methane | set | messageid: <1555369912.71.0.0405615227926.issue31954@roundup.psfhosted.org> |
2019-04-15 23:11:52 | methane | link | issue31954 messages |
2019-04-15 23:11:52 | methane | create | |
|