Ned Deily added the comment:
Python's platform module has both platform-independent and platform-dependent
functions as noted in its documentation. While it isn't as clearly documented
as perhaps it should be, on most "Unix-y" platforms, like OS X, much of the
platform-independent system information comes from the same source as the
platform's "uname" command. You can see that, if you use platform.uname(), it
matches the output of OS X's uname(1) command:
>>> platform.uname()
('Darwin', 'kitt.local', '15.5.0', 'Darwin Kernel Version 15.5.0: Tue Apr 19
18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64', 'x86_64', 'i386')
>>> platform.system()
'Darwin'
>>> platform.release()
'15.5.0'
$ uname -a
Darwin kitt.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT
2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Somewhat confusingly, "Darwin" is how the OS X kernel identifies itself and
"15.5.0" is the Darwin version number that corresponds to OS X 10.11.5. And
the uname output is what the platform module uses.
For OS X, the platform module does provide a Mac-specific function,
platform.mac_ver. From it, you can get the OS X version information, rather
than the Darwin kernel information.
>>> platform.mac_ver()
('10.11.5', ('', '', ''), 'x86_64')
Suggestions on how to improve the documentation are welcome! But changing the
results from the platform-independent functions after all these years is not
likely to happen.
https://docs.python.org/2.7/library/platform.html#cross-platform
https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
----------
nosy: +lemburg
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com