Inada Naoki <songofaca...@gmail.com> added the comment:
@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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31954> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com