Will Maier <[EMAIL PROTECTED]> writes:

> On Fri, Sep 07, 2007 at 12:03:23PM -0000, Steven D'Aprano wrote:
> [...]
> > which is easy enough, but I thought I'd check if there was an
> > existing solution in the standard library that I missed. Also, for
> > other applications, I might want them to be rather less
> > predictable.
> 
> 2.5 includes the uuid module for RFC 4122 universally-unique IDs:
> 
>     http://docs.python.org/lib/module-uuid.html

I second this recommendation. If you want arbitrary unique IDs that
are not a function of the data they identify, the simplest solution is
a monotonically-increasing serial number. If you want more than that,
you might as well go straight to the standard UUIDs.

Even if you're not using Python 2.5, grab the external 'python-uuid'
package for your operating system and use that. If you use the options
for including random elements, the generated UUIDs will even satisfy
your "unpredictable" requirement.

-- 
 \      "This sentence contradicts itself -- no actually it doesn't."  |
  `\                                             -- Douglas Hofstadter |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to