[Python-Dev] UUID module

Mike Brown mike at skew.org
Sat Jun 10 09:00:39 CEST 2006

Fredrik Lundh wrote:
> Ka-Ping Yee wrote:
> > Quite a few people have expressed interest in having UUID
> > functionality in the standard library, and previously on this
> > list some suggested possibly using the uuid.py module i wrote:
> > 
> >     http://zesty.ca/python/uuid.py
> +1!

+1 as well.

I have a couple of suggestions for improving that implementation:

1. You're currently using os.urandom, which can raise a NotImplementedError. 
You should be prepared to fall back on a different PRNG... which leads to the
2nd suggestion:

2. random.randrange is a method on a default random.Random instance that,
although seeded by urandom (if available), may not be the user's preferred
PRNG.  I recommend making it possible for the user to supply their own
random.Random instance for use by the module.

That's all. :)

More information about the Python-Dev mailing list