June 20th, 2006

Small contribution.

Hooray! My uuid.py module made it into the standard library for Python 2.5. I also posted it to the Cheese Shop, Python's repository of community-contributed modules, where you can download it for use with Python 2.3 or 2.4 if you need a convenient way to generate and manipulate UUIDs.

Many thanks to all the people who made suggestions for improvements (on this journal and elsewhere). It's much better due to this feedback. Some of the significant changes are:
  • UUID objects are now immutable, hashable, and can be used as dictionary keys.
  • The internal representation is now a single long integer, which is more efficient.
  • You can convert a UUID to and from: a 16-byte string, a tuple of six integers, a string of 32 hex digits, a hyphenated string of hex digits, a URN, or a single long integer.
  • The hardware address is obtained using Unix or Windows library calls if they're available, which is much faster and cheaper than spawning ifconfig or ipconfig.exe like it used to.
Probably most of the people reading this post will never have any reason to use it or notice it, but it feels good to contribute a little piece of something that will end up on your computer one day if you use Mac OS or Linux.