Re:Python dicts are now ordered
by hencoappel on Friday February 07, 2020 @05:22PM
(#22271746)
If memory serves me correctly, ever since dicts became ordered the OrderedDict simply became a subclass of dict, so it will have exactly the same performance characteristics.
OrderedDict was always a subclass of dict maintaining additional information (which is not free, it has to store and manipulate two pointers per entry).
It remains so today, ordereddict is not an alias or trivial facade to the normal dict because it has to maintain its doubly linked list and implement a bunch of additional operations based on that e.g. pop first or move to end.
Re:Python dicts are now ordered
by edflsafoiewq on Friday February 07, 2020 @05:31PM
(#22271838)
Yup.
>>> isinstance(OrderedDict(), dict)
True
It has useful features for manipulating ordering but while I've regularly needed had use for maintaining insertion ordering I can't remember ever needing to move items around within a map.