The documentation for the UUID module says the UUID.version field is "The UUID version number (1 through 5, meaningful only when the variant is RFC_4122)".
However, the UUID constructor doesn't actually validate that the version lies in that range if you don't pass a version to the constructor and, as a result, this isn't actually true - the version number can be anything between 0 and 15.
For an example consider the following:
>>> from uuid import UUID
>>> u = UUID(int=1133377179260751706062848)
>>> u.variant
'specified in RFC 4122'
>>> u.version
15
I have only actually run this example on Python 3.6, but inspection of the code suggests that it's been like this since its introduction. |