Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(195688)

Side by Side Diff: Doc/library/uuid.rst

Issue 26267: UUID docs should say how to get "standard form"
Patch Set: Created 3 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`uuid` --- UUID objects according to RFC 4122 1 :mod:`uuid` --- UUID objects according to RFC 4122
2 ================================================== 2 ==================================================
3 3
4 .. module:: uuid 4 .. module:: uuid
5 :synopsis: UUID objects (universally unique identifiers) according to RFC 412 2 5 :synopsis: UUID objects (universally unique identifiers) according to RFC 412 2
6 .. moduleauthor:: Ka-Ping Yee <ping@zesty.ca> 6 .. moduleauthor:: Ka-Ping Yee <ping@zesty.ca>
7 .. sectionauthor:: George Yoshida <quiver@users.sourceforge.net> 7 .. sectionauthor:: George Yoshida <quiver@users.sourceforge.net>
8 8
9 **Source code:** :source:`Lib/uuid.py` 9 **Source code:** :source:`Lib/uuid.py`
10 10
(...skipping 26 matching lines...) Expand all
37 UUID(bytes=b'\x12\x34\x56\x78'*4) 37 UUID(bytes=b'\x12\x34\x56\x78'*4)
38 UUID(bytes_le=b'\x78\x56\x34\x12\x34\x12\x78\x56' + 38 UUID(bytes_le=b'\x78\x56\x34\x12\x34\x12\x78\x56' +
39 b'\x12\x34\x56\x78\x12\x34\x56\x78') 39 b'\x12\x34\x56\x78\x12\x34\x56\x78')
40 UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) 40 UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
41 UUID(int=0x12345678123456781234567812345678) 41 UUID(int=0x12345678123456781234567812345678)
42 42
43 Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given. 43 Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given.
44 The *version* argument is optional; if given, the resulting UUID will have it s 44 The *version* argument is optional; if given, the resulting UUID will have it s
45 variant and version number set according to RFC 4122, overriding bits in the 45 variant and version number set according to RFC 4122, overriding bits in the
46 given *hex*, *bytes*, *bytes_le*, *fields*, or *int*. 46 given *hex*, *bytes*, *bytes_le*, *fields*, or *int*.
47
48
49 :class:`UUID` instances support the following operations:
50
51 .. describe:: str(uuid)
berkerpeksag 2016/08/03 10:09:25 It would be better to be less verbose here. This c
52
53 Returns a string in the form ``12345678-1234-5678-1234-567812345678``
54 where the 32 hexcadecimal digits represent the UUID
55
56 .. describe:: uuid1 == uuid2
berkerpeksag 2016/08/03 10:09:25 Same as above. See datetime or decimal documentati
ammar2 2016/08/06 05:20:17 So datetime takes the approach of documenting oper
berkerpeksag 2016/09/11 09:12:18 Sorry, I wasn't very clear in my earlier message.
57 .. describe:: uuid1 < uuid2
58 .. describe:: uuid1 > uuid2
59
60 Compares two UUID instances by way of comparing their :attr:`UUID.int`
61 attributes
47 62
48 63
49 :class:`UUID` instances have these read-only attributes: 64 :class:`UUID` instances have these read-only attributes:
50 65
51 .. attribute:: UUID.bytes 66 .. attribute:: UUID.bytes
52 67
53 The UUID as a 16-byte string (containing the six integer fields in big-endian 68 The UUID as a 16-byte string (containing the six integer fields in big-endian
54 byte order). 69 byte order).
55 70
56 71
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 '00010203-0405-0607-0809-0a0b0c0d0e0f' 264 '00010203-0405-0607-0809-0a0b0c0d0e0f'
250 265
251 >>> # get the raw 16 bytes of the UUID 266 >>> # get the raw 16 bytes of the UUID
252 >>> x.bytes 267 >>> x.bytes
253 b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' 268 b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
254 269
255 >>> # make a UUID from a 16-byte string 270 >>> # make a UUID from a 16-byte string
256 >>> uuid.UUID(bytes=x.bytes) 271 >>> uuid.UUID(bytes=x.bytes)
257 UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') 272 UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
258 273
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+