11 Jun
2016
11 Jun
'16
9:35 p.m.
[Guido]
... An alternative would be to keep the secrets module linked to SystemRandom, and improve the latter. Its link with os.random() is AFAIK undocumented. Its API is clumsy but for code that needs some form of secret-ish bytes and requires platform and Python version independence it might be better than anything else. Then the secrets module is just what we recommend new users on Python 3.6.
There's an issue currently open about this: http://bugs.python.org/issue27288 The docs for SystemRandom are very brief, so people may have actually noticed ;-) the first sentence: Class that uses the os.urandom() function for generating random numbers ... IOW, "uses os.urandom()" has been one of its only advertised qualities.