[issue31265] Remove doubly-linked list from C OrderedDict

Raymond Hettinger report at bugs.python.org
Sun Sep 10 20:52:21 EDT 2017


Raymond Hettinger added the comment:

ISTM that what is being proposed is an algorithmically flawed re-implementation of the ordered dictionary.  I'm unclear about whether you understand and acknowledge why the doubly-linked list was chosen and what kind of workloads it supports (we didn't choose it because it was either convenient or fun, we chose it because it was an algorithmically correct way of supporting arbitrary deletion, move-to-front, move-to-back, pop-first, and pop-last operations all of which have legitimate use cases).

Side note: part of the goal of the collections module is to provide builtin datatypes alternatives which different performance characteristics.  For example, deque() has a list-like API but is there to support efficient appends and pops from both ends while giving up efficient random access (another goal was obtaining more predictable performance by avoiding realloc()).

On a procedural note, it isn't a good practice to go "opinion shopping" as a way of trying to override the recommendations of the current maintainers of the code.  That seems like uncomfortable political gamesmanship.  Instead of throwing-out all the code, it would be a better to submit implementation improvements that preserve the core design (for example there are faster and more compact ways to store and update the links -- I can help get you started with this if you're interested).

----------
nosy: +aronacher

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31265>
_______________________________________


More information about the Python-bugs-list mailing list