Is iterating over the same frozenset guaranteed always to produce the items in the same order? (Python 3)
问题 For example, when I execute frozen = frozenset(('kay', 'snow queen')) , then tuple(frozen) , I get ('kay', 'snow queen') . (When / how) is it possible, if ever, for iter(frozen) to produce the items in a different order? (When / how) will tuple(frozen) return ('snow queen', 'kay') ? I am using Python 3 almost all of the time, but I would also be curious about Python 2. 回答1: By default, the hash values of str objects are salted with an unpredictable random value. Although they remain constant