We created an OrderedDict, but the constructor was using **kwargs which means the arguments we passed to it were stored in a regular dict and got reordered before OrderedDict.__init__ could store them in order.
With Python 3.6+, the **kwargs stores the arguments in the same order they were written, and the OrderedDict construction works as expected:
dict
ordering is important because keyword arguments are stored in a dict. Consider this:We created an
OrderedDict
, but the constructor was using**kwargs
which means the arguments we passed to it were stored in a regulardict
and got reordered beforeOrderedDict.__init__
could store them in order.With Python 3.6+, the
**kwargs
stores the arguments in the same order they were written, and theOrderedDict
construction works as expected: