[TIP] testing and hash values

Chris Jerdonek chris.jerdonek at gmail.com
Sun Sep 29 09:56:51 PDT 2013


I have a question about the behavior of hashing prior to Python 3.3
(when hash randomization was turned on by default [1]).

I know that in earlier versions Python never made any guarantees about
hash values and their effect on dictionary key ordering, etc [2].  But
for testing purposes, in practice, to what extent does hashing behave
the same across systems and Python versions prior to Python 3.3?  For
example, the note at [2] says that "it typically varies between 32-bit
and 64-bit builds."

I'm asking because I'm curious about the extent to which tests that
unknowingly depend on hash values are reproducible across systems and
versions.

--Chris

[1] http://docs.python.org/3/whatsnew/3.3.html#builtin-functions-and-types
[2] http://docs.python.org/2/using/cmdline.html#cmdoption-R



More information about the testing-in-python mailing list