Skip to content

bpo-31928: DOC: Update sys.version_info references to reflect named tu…#4239

Closed
csabella wants to merge 1 commit intopython:masterfrom
csabella:version
Closed

bpo-31928: DOC: Update sys.version_info references to reflect named tu…#4239
csabella wants to merge 1 commit intopython:masterfrom
csabella:version

Conversation

@csabella
Copy link
Contributor

@csabella csabella commented Nov 2, 2017

@csabella csabella changed the title bpo31928: DOC: Update sys.version_info references to reflect named tu… bpo-31928: DOC: Update sys.version_info references to reflect named tu… Nov 2, 2017
is ``(2, 0, 0, 'final', 0)``. The components can also be accessed by name,
so ``sys.version_info[0]`` is equivalent to ``sys.version_info.major``
and so on.
A :class:`~collections.namedtuple` containing the five components of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version_info is not a collections.namedtuple. It is a named tuple. collections.namedtuple implements named tuple interface, but not all named tuples are collections.namedtuple.

Just add the word "named" before "tuple".

All values except *releaselevel* are integers; the release level is
``'alpha'``, ``'beta'``, ``'candidate'``, or ``'final'``. The
``version_info`` value corresponding to the Python version 3.6.3 is
``(major=3, minor=6, micro=3, releaselevel='final', serial=0)``. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(major=3, minor=6, micro=3, releaselevel='final', serial=0) looks too verbose. And this is not a valid Python syntax. If you want to expose repr(sys.version_info), you should add sys.version_info at the start and make it yet more verbose.

The current writing looks better to me. This is a tuple of version_info components. It is common to compare version_info with a tuple.

if sys.version_info < (3, 7):
    ...

``sys.version_info(1, 8, 0, 'final', 0)``, whereas ``sys.version_info``
would be ``sys.version_info(2, 7, 2, 'final', 0)``. For CPython they
are the same value, since it is the reference implementation.
``sys.version_info(major=1, minor=8, micro=0, releaselevel='final', serial=0)``,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current writing LGTM. sys.version_info(1, 8, 0, 'final', 0) is not a repr, this is a constructor. sys.version_info(major=1, minor=8, micro=0, releaselevel='final', serial=0) looks too verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I thought it should look the way it is in the console when sys.version_info is typed. I didn't realize it was a constructor. I'll withdraw the PR.

@csabella csabella closed this Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants