On 15 April 2016 at 19:39, Victor Stinner <victor.stin...@gmail.com> wrote: > Hi, > > 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". Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com