Why is the order in dictionaries and sets arbitrary?
Note: This answer was written before the implementation of the dict type changed, in Python 3.6. Most of the implementation details in this answer still apply, but the listing order of keys in dictionaries is no longer determined by hash values. The set implementation remains unchanged. The order is not arbitrary, but depends on the … Read more