Re:Making Python Less Random
by kstrauser on Thursday July 11, 2024 @10:53PM
(#40942423)
The hash bit is by design. See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHA... and http://ocert.org/advisories/ocert-2011-003.html for more.
[ Parent
| on HN ]
Correct. But it's not often mentioned until you go looking for it.
I think the right mental model of a hash is that it's a transient value. There's no setting in which it makes sense to store it unless you explicitly control the hash function. Even in languages where it is static over runs, it can change over language versions, which any saved data will (presumably) eventually hit.
Yes, while it's a great practice, it's just something that newbies of any programming like me at the time may run into. Often when being taught programming, hash functions are purely functions of input data. My point was that Python, for very valid and good reasons, does not do that.