Quoting from python documentation I have:
Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
Link for the above documentation
But the following code makes me think that it's not ordered:
from collections import OrderedDict
d1 = dict()
d2 = dict()
d1['a'] = 1
d1['b'] = 2
d2['b'] = 2
d2['a'] = 1
print(d1 == d2)
d3 = OrderedDict()
d4 = OrderedDict()
d3['a'] = 1
d3['b'] = 2
d4['b'] = 2
d4['a'] = 1
print(d3 == d4)
The above code generates the output(for python 3.7.5):
True
False
Essentially dict() should show the same behavior as OrderedDict() from collections module, but it doesn't. Please elaborate.