Dictionaries are not ordered, so there is no ordering that will match the dictionary's ordering (it doesn't have one). You can observe this in the fact that two dictionaries specified with the same keys/values in different orders are considered equivalent:
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> {'foo': True, 'bar': False} == {'bar': False, 'foo': True}
True
Given your example, the easiest fix would be to just initialize the list in the order you want to have it in, since these values are all hardcoded anyway. In a more complex example, the solution might be to either use an OrderedDict
or to use a dict combined with a list that maintains the ordering.