Generating unique numbers?
Aahz
aahz at pythoncraft.com
Sat Jun 1 13:09:36 EDT 2002
In article <3CF8FC1C.7060903 at lindbergs.org>, VanL <news at lindbergs.org> wrote:
>
>The reason why I am wanting keys that are more likely to be globally
>unique is because I will be building in hooks to make this outliner
>network transparent (using ZEO), making it possible for multiple
>outliners to be used together as a real-time collaborative tool. I
>want to be able to be able to have people merge stuctures that people
>have made in the standalone instance into a shared instance without
>tromping on another nodes data.
>
>Based on what people have said, I was thinking of using some
>combination of DateTime.gmticks and the id of the obj, making it (I
>think) extremely unlikely that there would be a collision.
id() is very, very bad for any kind of persistent ID; I still think it's
at least very bad even if you add in any kind of time.
No, if you want to trade IDs across a network, you need GUIDs (DCE
UUIDs). There's just no way around that. It's not the most perfect
system in the world, but it's better than any other generally available
scheme.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"In the end, outside of spy agencies, people are far too trusting and
willing to help." --Ira Winkler
More information about the Python-list
mailing list