Message220023
To expand a bit, this is by design, a consequence of the hash randomization feature; see
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED
As noted there, if necessary, it is possible to disable hash randomization. But tests with set values or dict keys should not depend on a particular order as even disabling hash randomization would not guarantee the same results on different platforms or builds of Pythons.
$ python3.4 -c "print(set(['A', 'B']))"
{'B', 'A'}
$ python3.4 -c "print(set(['A', 'B']))"
{'A', 'B'}
$ python3.4 -c "print(set(['A', 'B']))"
{'B', 'A'}
$ PYTHONHASHSEED=0 python3.4 -c "print(set(['A', 'B']))"
{'B', 'A'}
$ PYTHONHASHSEED=0 python3.4 -c "print(set(['A', 'B']))"
{'B', 'A'}
$ PYTHONHASHSEED=0 python3.4 -c "print(set(['A', 'B']))"
{'B', 'A'} |
|
Date |
User |
Action |
Args |
2014-06-08 06:58:31 | ned.deily | set | recipients:
+ ned.deily, benjamin.peterson, Jackson.Cooper |
2014-06-08 06:58:31 | ned.deily | set | messageid: <1402210711.81.0.557607093119.issue21691@psf.upfronthosting.co.za> |
2014-06-08 06:58:31 | ned.deily | link | issue21691 messages |
2014-06-08 06:58:31 | ned.deily | create | |
|