Ned Deily added the comment:

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'}

----------
nosy: +ned.deily
stage:  -> resolved

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21691>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to