[docs] [issue30051] Document that the random module doesn't support fork

Raymond Hettinger report at bugs.python.org
Sun Apr 16 22:04:36 EDT 2017


Raymond Hettinger added the comment:

Several thoughts:

* AFAICT, in entire the history of this module, no user has ever reported this as being a source of confusion, so I don't think there is a real documentation issue here. 

* Regarding, "after fork, the parent and the child produce the same "random" number sequence", this is the expected behavior of a PRNG.  If it did something thing different, THAT would be a bug.

* There random module is likely the wrong place for a note.   It is more properly a topic about forking itself.  Perhaps there is room for a FAQ entry about forking elaborating on the broad range of state that is shared across forks (lock and file descriptors, etc).

* For those who need it, the API already supports reseeding and a way to make new instances of Random.  Both of those are the standard ways of doing it for people who need independent generators in different threads.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30051>
_______________________________________


More information about the docs mailing list