New submission from STINNER Victor <victor.stin...@haypocalc.com>: #12326 proposes to remove the major version from sys.platform. If we remove it, we will need another easy way to get this information. I don't think that we need the version used to build Python, but the version at runtime. That's why the platform is a good candidate to add such information.
I propose to add platform.major(): major version of the system, or 0 if we cannot get it. I chose 0 instead of None or raising an error to be consistent with the other functions. Platform functions don't raise error and always return the same type. For example, platform.release() returns an empty string if the release string cannot be read. Each system formats its full version (e.g. (2, 6, 28) for Linux 2.6.28) differently. It is easier and more reliable to only provide the major version. If you would like to get more information (e.g. minor minor), you have to test the system name. See for example platform.mac_ver(), platform.win_ver(), and also test.support.requires_linux_version(). Attached patch implements platform.major(). ---------- files: platform_major.patch keywords: patch messages: 142538 nosy: haypo, lemburg priority: normal severity: normal status: open title: platform: add a major function to get the system major version versions: Python 3.3 Added file: http://bugs.python.org/file22963/platform_major.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12794> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com