New submission from Andrew Barnert:

Most real-world code that uses the UUID module wants either the standard format 
'{12345678-1234-5678-1234-567812345678}', or the same thing without the braces.

There are a number of different documented accessors, but none of them give you 
either of these. The simplest way I can think of to guarantee the standard 
format from what's documented is '{%08x-%04x-%04x-%02x%02x-%12x}' % u.fields.

It might be nice to add accessors for standard form and braceless standard 
form, but that probably isn't necessary--as long as there's documentation 
saying that __str__ returns the braceless standard form.

The example code does say that, but I don't think people can trust that a 
comment in an example is binding documentation--plus, plenty of people don't 
read the examples looking for more information about things that aren't 
documented. And I've seen people come up with buggy versions of the format 
string that miss leading zeros, or horrible things like repr(u)[6:42].

----------
assignee: docs@python
components: Documentation
messages: 259414
nosy: abarnert, docs@python
priority: normal
severity: normal
status: open
title: UUID docs should say how to get "standard form"
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26267>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to