Search code examples
pythonsys

serial in sys.version_info of python


The sys.version_info output is ('major', 'minor', 'micro', 'releaselevel', 'serial'). I find that most of the explanations of this function outputs serial=0. I really don't understand what is this 'serial'? What does it mean? Why is it always 0?


Solution

  • The .serial part of the named tuple sys.version_info is always 0 for final releases, and when you download and install any version of Python from python.org, you're downloading final releases.

    However, alphas, betas and candidates can have different serials.

    See also the documentation on API and ABI versioning on python.org.

    The specific example given there:

    PY_RELEASE_SERIAL
    The 2 in 3.4.1a2. Zero for final releases.

    This makes sense because there can be a series of alpha releases, and the serial number tells you which alpha you're looking at. Similarly, there can be multiple betas and even multiple release candidates. But there's always only a single final release, which will have number 0.

    Any official releases after that would get a new version number, and they would go through the same process until they achieve a new final release, again with serial 0.