[Python-checkins] peps: PEP 504: expand ensure_repeatable docstring

nick.coghlan python-checkins at python.org
Wed Sep 16 16:31:49 CEST 2015


https://hg.python.org/peps/rev/8912fd9e3ece
changeset:   6067:8912fd9e3ece
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Thu Sep 17 00:31:39 2015 +1000
summary:
  PEP 504: expand ensure_repeatable docstring

files:
  pep-0504.txt |  13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)


diff --git a/pep-0504.txt b/pep-0504.txt
--- a/pep-0504.txt
+++ b/pep-0504.txt
@@ -61,7 +61,18 @@
 additional level of indirection)::
 
     def ensure_repeatable():
-        """Switch to using random.Random() for the module level APIs"""
+        """Switch to using random.Random() for the module level APIs
+
+        This switches the default RNG instance from the crytographically
+        secure random.SystemRandom() to the deterministic random.Random(),
+        enabling the seed(), getstate() and setstate() operations. This means
+        a particular random scenario can be replayed later by providing the
+        same seed value or restoring a previously saved state.
+
+        NOTE: Libraries implementing security sensitive operations should
+        always explicitly use random.SystemRandom() or os.urandom in order to
+        correctly handle applications that call this function.
+        """
         if not isinstance(_inst, Random):
             _inst = random.Random()
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list