Hi,

I am wondering if it would be good to add an additional keyword `seed` to the 
builtin function *hash* to allow us to set arbitrary seed to ensure 
reproducible results.
As far as I know, there exists already the environment variable PYTHONHASHSEED 
that allows us to set arbitrary seed or disable the seed globally for the 
python interpreter.
However, it looks like that it would be too bold to use that environment 
variable to change the default behavior because the random seed generation 
helps improve the security my reducing the risk of hash flooding.

In parallel, we have identified a couple of real use cases that require that an 
arbitrary seed is used for a limited scope.
For instance, if we create a caching programming interface that relies on a 
distributed kv store, it would be very important to make sure that the hash key 
stays the same when the application is rebooted or replicated. It is generally 
more cautious to use the above capability to limit the scope to the caching 
library itself instead of applying the same for all the hash functions of all 
the python interpreters.

WDYT?

Kind regards,

Hao
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RRPEOREIWJ4AGDOYWQKIT6SRTC5ISDP3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to