[Python-Dev] UUID module

Phillip J. Eby pje at telecommunity.com
Mon Jun 12 03:55:04 CEST 2006


At 07:24 PM 6/11/2006 -0500, Ka-Ping Yee wrote:
>Thomas Heller wrote:
> > I don't know if this is the uuidgen you're talking about, but
> > on linux there is libuuid:
>
>Thanks!
>
>Okay, that's in there now.  Have a look at http://zesty.ca/python/uuid.py .
>
>Phillip J. Eby wrote:
> > By the way, I'd love to see a uuid.uuid() constructor that simply calls the
> > platform-specific default UUID constructor (CoCreateGuid or uuidgen(2)),
>
>I've added code to make uuid1() use uuid_generate_time() if available
>and uuid4() use uuid_generate_random() if available.  These functions
>are provided on Mac OS X (in libc) and on Linux (in libuuid).  Does
>that work for you?

Sure - but actually my main point was to have a uuid() call you could use 
to just get whatever the platform's preferred form of GUID is, without 
having to pick what *type* you want.

The idea being that there should be some call you can make that will always 
give you something reasonably unique, without being overspecified as to the 
type of uuid.  That way, people can be told to use uuid.uuid() to get 
unique IDs for use in their programs, without having to get into what types 
of UUIDs do what.

Perhaps that isn't feasible, or is a bad idea for some other reason, but my 
main point was to have a call that means "get me a good unique ID".  :)



More information about the Python-Dev mailing list