On 11 September 2015 at 08:54, Andrew Barnert via Python-ideas wrote:
Actually, I just thought of an even simpler solution:

Add a deterministic_singleton member to random (which is just initialized to DeterministicRandom() at startup). Now, the user fix is just to change "import random" to "from random import deterministic_singleton as random".

Change the spelling to "import random.seeded_random as random" and the
user fix is even shorter.

I do agree with the idea of continuing to provide a process global
instance of the current PRNG for ease of migration - changing a single
import is a good way to be able to address a deprecation, and looking
for the use of seeded_random in a security sensitive context would
still be fairly straightforward.


Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia

Search Discussions

Discussion Posts


Follow ups

Related Discussions



site design / logo © 2018 Grokbase