On 15 April 2016 at 19:39, Victor Stinner email@example.com wrote:
Would it make sense to add a function to generate a random UUID4 (as a string) in secrets?
The current implement in uuid.py of CPython 3.6 already uses os.urandom():
def uuid4(): """Generate a random UUID.""" return UUID(bytes=os.urandom(16), version=4)
I don't think so, as folks looking to generate a UUID specifically are already likely to end up at the uuid module docs rather than trying to craft their own based on the random module (and the uuid module already does the right thing, and it would be a bug if it didn't).
The new secrets module fills the gap for cases where random is otherwise an attractive nuisance by making it easy to say "use this instead".
-- Nick Coghlan | firstname.lastname@example.org | Brisbane, Australia