4343 >>> x.bytes
4444 b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
4545
46- # make a UUID from a 16-byte string
46+ # make a UUID from a 16-byte bytes object
4747 >>> uuid.UUID(bytes=x.bytes)
4848 UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
4949
@@ -118,19 +118,19 @@ class UUID:
118118 '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts
119119 five possible forms: a similar string of hexadecimal digits, or a tuple
120120 of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
121- 48-bit values respectively) as an argument named 'fields', or a string
122- of 16 bytes (with all the integer fields in big-endian order) as an
123- argument named 'bytes', or a string of 16 bytes (with the first three
124- fields in little-endian order) as an argument named 'bytes_le', or a
125- single 128-bit integer as an argument named 'int'.
121+ 48-bit values respectively) as an argument named 'fields', or a 16-byte
122+ bytes object (with all the integer fields in big-endian order) as an
123+ argument named 'bytes', or a 16-byte bytes object (with the first three
124+ fields in little-endian order) as an argument named 'bytes_le', or a single
125+ 128-bit integer as an argument named 'int'.
126126
127127 UUIDs have these read-only attributes:
128128
129- bytes the UUID as a 16-byte string (containing the six
129+ bytes the UUID as a 16-byte bytes object (containing the six
130130 integer fields in big-endian byte order)
131131
132- bytes_le the UUID as a 16-byte string (with time_low, time_mid ,
133- and time_hi_version in little-endian byte order)
132+ bytes_le the UUID as a 16-byte bytes object (with time_low,
133+ time_mid, and time_hi_version in little-endian byte order)
134134
135135 fields a tuple of the six integer fields of the UUID,
136136 which are also available as six individual attributes
@@ -179,7 +179,7 @@ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
179179 int = None , version = None ,
180180 * , is_safe = SafeUUID .unknown ):
181181 r"""Create a UUID from either a string of 32 hexadecimal digits,
182- a string of 16 bytes as the 'bytes' argument, a string of 16 bytes
182+ a 16-byte bytes object as the 'bytes' argument, a 16-byte bytes object
183183 in little-endian order as the 'bytes_le' argument, a tuple of six
184184 integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version,
185185 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as
@@ -191,9 +191,9 @@ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
191191 UUID('{12345678-1234-5678-1234-567812345678}')
192192 UUID('12345678123456781234567812345678')
193193 UUID('urn:uuid:12345678-1234-5678-1234-567812345678')
194- UUID(bytes='\x12\x34\x56\x78'*4)
195- UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' +
196- '\x12\x34\x56\x78\x12\x34\x56\x78')
194+ UUID(bytes=b '\x12\x34\x56\x78'*4)
195+ UUID(bytes_le=b '\x78\x56\x34\x12\x34\x12\x78\x56' +
196+ b '\x12\x34\x56\x78\x12\x34\x56\x78')
197197 UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
198198 UUID(int=0x12345678123456781234567812345678)
199199
0 commit comments