Both dicts and sets in python lose order. This is because they are implemented as hash tables and therefore more concerned with faster lookup times than with order preservation.
If you are looking for a data structure that's geared towards order-preservation, then you should look at lists. In your case, you could use a list of tuples as follows:
In [255]: L = []
In [256]: L.append((1,10))
In [257]: L.append((2,20))
In [258]: L.append((3,30))
In [259]: L
Out[259]: [(1, 10), (2, 20), (3, 30)]
If however, you want to preserve order and want faster lookup times than what list has to offer, then you're likely better off with an OrderedDict:
In [265]: d = collections.OrderedDict()
In [266]: d[1]=10
In [267]: d
Out[267]: OrderedDict([(1, 10)])
In [268]: d[2]=20
In [269]: d
Out[269]: OrderedDict([(1, 10), (2, 20)])
In [270]: d[3]=30
In [271]: d
Out[271]: OrderedDict([(1, 10), (2, 20), (3, 30)])
Hope this helps
Why it happensportion of your question, laurentluce.com/posts/python-dictionary-implementation