Python Glossary Русский

Python 3.14+uuidfunction

uuid.uuid8()

generating UUIDs

A version 8 UUID for a custom layout: three integers a, b, c (48, 12 and 62 bits) are placed into the UUID as is. New in 3.14.

Syntax

uuid.uuid8(a=None, b=None, c=None)

Missing arguments are filled with random numbers, but not from a secure generator: uuid8() without arguments is predictable and unfit as a token — use uuid4() for that. Extra high bits are silently dropped, no error is raised. The point of this version is a field layout of your own that only your system understands.

Examples

import uuid
print(uuid.uuid8(1, 2, 3))  # → 00000000-0001-8002-8000-000000000003
print(uuid.uuid8(0, 0, 0).version)  # → 8

See also

Open in the full glossarydocs.python.orgReport an inaccuracy