sys.hexversion

sys.hexversion

The version number encoded as a single integer. This is guaranteed to increase with each version, including proper support for non-production releases. For example, to test that the Python interpreter is at least version 1.5.2, use:

if sys.hexversion >= 0x010502F0:
    # use some advanced feature
    ...
else:
    # use an alternative implementation or warn the user
    ...

This is called hexversion since it only really looks meaningful when viewed as the result of passing it to the built-in hex() function. The struct sequence sys.version_info may be used for a more human-friendly encoding of the same information.

More details of hexversion can be found at API and ABI Versioning.

doc_python
2016-10-07 17:43:53
Comments
Leave a Comment

Please login to continue.