[Zope] Which method to generate IDs for objects?

Markus Schaber markus.schaber@student.uni-ulm.de
Wed, 16 Jan 2002 16:25:34 +0100


Hi,

Maik Jablonski wrote:

> a simple approach: i would use hash() on a unique "property" of your 
> objects... this can be the source of the document or a combination of 
> unique properties...
> 
> for example: if you would like to store emails, you could use a hash
> of "sender","subject","date","body".
> 
> id=str(hash(sender+subject+date+body))
> 
> mails with exactly the same values for that would be identical (result
> will be the same hash-value)... and there's no need to store them.

No, not really. A hash is just very likely to be different for different
data, but it is not guaranteed.


Markus

-- 
"GPL software is not free - the cost is cooperation"