osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PYTHONHASHSEED VALUE


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