PYTHONHASHSEED VALUE

Rishabh Mishra rishabhm120497 at gmail.com
Tue May 14 03:18:56 EDT 2019


Dear Sir/Ma'am,

I was upgrading a codebase from python2 to python3. The testcases fail in
python3 code because the set() function produces a different order from
python2.

e.g. set in py2 ={"it","is","rishabh","Mishra"}

Here in python 2.7 the PYTHONHASHSEED is disabled.

in py3 set ={"rishabh","it","is","mishra"}

I want the order to stay consistent with python2.7 to pass the test cases.

In python 3.3 above PYTHONHASHSEED=0 disbales the random shuffling but it
doesn't yield the same order as 2.7

So can you tell me for what value of PYTHONHASHSEED the order will stay
consistent?

Thank-You!

Yours sincerely,
Rishabh Mishra



More information about the Python-list mailing list