TLDR: If you insert them by size and use Python >= 3.7 (or CPython >= 3.6), it is safe to use a regular dictionary. If you don't - use OrderedDict
.
Dictionaries are ordered by the insertion order from Python 3.6. This order was just an implementation detail, the release notes for Python 3.6 said the following:
The order-preserving aspect of this new implementation is considered an implementation detail and should not be relied upon (this may change in the future, but it is desired to have this new dict implementation in the language for a few releases before changing the language spec to mandate order-preserving semantics for all current and future Python implementations; this also helps preserve backwards-compatibility with older versions of the language where random iteration order is still in effect, e.g. Python 3.5).
From Python 3.7 onwards, the Python standard requires that dictionaries should be ordered by the insertion order.