Several dictations with the same set of keys

advertisements

If I have multiple dicts that have the same set of keys (and nearly the same values), will the the two dicts have the same ordering of entries? Or is the process of hashing not that predictable?


No, you can't expect the ordering to be same, since dict makes no guarantees about the ordering of its keys.

collections.OrderedDict is designed to preserve the insertion order of its keys, so you could use that if ordering is important.