Message142538
| Author |
vstinner |
| Recipients |
lemburg, vstinner |
| Date |
2011年08月20日.15:30:39 |
| SpamBayes Score |
2.7534641e-12 |
| Marked as misclassified |
No |
| Message-id |
<1313854240.58.0.391549455564.issue12794@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
#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(). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年08月20日 15:30:40 | vstinner | set | recipients:
+ vstinner, lemburg |
| 2011年08月20日 15:30:40 | vstinner | set | messageid: <1313854240.58.0.391549455564.issue12794@psf.upfronthosting.co.za> |
| 2011年08月20日 15:30:39 | vstinner | link | issue12794 messages |
| 2011年08月20日 15:30:39 | vstinner | create |
|