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:
dictordering is important because keyword arguments are stored in a dict. Consider this:We created an
OrderedDict, but the constructor was using**kwargswhich means the arguments we passed to it were stored in a regulardictand got reordered beforeOrderedDict.__init__could store them in order.With Python 3.6+, the
**kwargsstores the arguments in the same order they were written, and theOrderedDictconstruction works as expected: