4 ms·
Python's ordered dict uses an efficient linked list implementation, it might be elegant here?
by ianbicking 3y ago
Python's ordered dict uses an efficient linked list implementation, it might be elegant here?
- tommiegannert 3y agoOh, interesting. The documentation there also says > They have become less important now that the built-in dict class gained the ability to remember insertion order (this new behavior became guaranteed in Python 3.7). https://docs.python.org/3/library/collections.html#ordereddict-objects https://docs.python.org/3/library/collections.html#ordereddi... It assumes iterators are stable (and valid) under insertion, and I can't find any docs on that for either. Since you (AFAIK) can't create an iterator at a specific key, we also couldn't use keys as the "hand."