Platform-independent GUID creation?

Aahz Maruch aahz at panix.com
Sat Dec 22 13:45:56 EST 2001


In article <a02k4o$38b$1 at news1.xs4all.nl>,
Irmen de Jong <usenet at NOSPAM-irmen.cjb.net> wrote:
>"Aahz Maruch" <aahz at panix.com> wrote in message
>news:a029l8$ctn$1 at panix3.panix.com...
>>
>> Nice try.  (That's partly serious, partly sarcasm.)  It probably works
>> for limited applications, but it's definitely not a guaranteed GUID.
>> One of the big problems with your method is that the widespread adoption
>> of NAT combined with excessive use of "private" IP addresses means that
>> there's a lot of IP address duplication out there.
>
>Yes, I realised that. But it had to be portable. So I took the IP address,
>the process ID and a random number.
>There's no guarantee here (certainly not!) that the number is unique, but
>the chances are pretty slim that you get an identical number.
>
>I don't have a better solution. If anybody has a better (Pythonic) GUID
>generator, I'd be very interested.

As I said earlier, the only truly safe ID creation mechanism is to
create GUIDs on a server and send them (possibly in batch) to the
client.  Granted, that's more overhead, but it *is* portable.

The other option for limited applications is to use a known guaranteed
unique ID (social security numbers in the US are *not*; I think ISBN
might be guaranteed unique).
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 9 days and counting



More information about the Python-list mailing list