Python Glossary Русский

Python 3.14+uuidfunction

uuid.uuid6()

generating UUIDs

A version 6 UUID from the time and the MAC — like uuid1(), but with the high bits of the time first, so strings sort by creation time. New in 3.14.

Syntax

uuid.uuid6(node=None, clock_seq=None)

It is for places that already use version 1 UUIDs but want sorting — for new code RFC 9562 recommends uuid7(). It reveals the machine's MAC just like uuid1(); the time field holds 100-nanosecond intervals since 15 October 1582, not Unix seconds. Before 3.14 the function is missing — AttributeError.

Examples

import uuid
u = uuid.uuid6()
print(u)  # → ? 1ef7425e-7c9e-6679-8f29-a7b78c460531 — время и MAC
print(u.version, u.variant, len(str(u)))  # → 6 specified in RFC 4122 36

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy