This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 vstinner
收信人 lemburg, vstinner
日期 2011-08-20.15:30:39
SpamBayes Score 2.7534641e-12
Marked as misclassified
Message-id <1313854240.58.0.391549455564.issue12794@psf.upfronthosting.co.za>
In-reply-to
内容
#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().
历史
日期 用户 动作 参数
2011-08-20 15:30:40vstinner修改recipients: + vstinner, lemburg
2011-08-20 15:30:40vstinner修改messageid: <1313854240.58.0.391549455564.issue12794@psf.upfronthosting.co.za>
2011-08-20 15:30:39vstinner链接issue12794 messages
2011-08-20 15:30:39vstinner创建