platform as part of sys (was pypy_vm)

"M.-A. Lemburg" <mal@egenix.com> wrote:
Le mardi 08 avril 2008 ? 13:42 -0400, Jim Jewett a ?crit :
If important information is in the interpreter-specific location, it would be nice to know where that is. That could be a specific module name, but a module-name-pattern might be enough.
...
We already have a way to identify the Python implementation and it works for CPython, IronPython and Jython:
import platform platform.python_implementation() 'CPython'
Great, assuming that the capitalization is still OK for a module name. But looking through platform convinced me that it really ought be part of the sys reorg. And it provides at least one pattern for dealing with stuff that doesn't make sense in some interpreter environments. For example, platform.dist() is defined as returning which *Linux* distribution is used. So on windows, the tuple contains empty strings. (Though I'm not sure why the libc_ver is also returning blanks.) -jJ

On 2008-04-09 20:43, Jim Jewett wrote:
"M.-A. Lemburg" <mal@egenix.com> wrote:
Le mardi 08 avril 2008 ? 13:42 -0400, Jim Jewett a ?crit :
If important information is in the interpreter-specific location, it would be nice to know where that is. That could be a specific module name, but a module-name-pattern might be enough.
...
We already have a way to identify the Python implementation and it works for CPython, IronPython and Jython:
import platform platform.python_implementation() 'CPython'
Great, assuming that the capitalization is still OK for a module name.
Just apply .lower() if needed. I don't particularly go for the all_lower_case_use_underscores style module names.
But looking through platform convinced me that it really ought be part of the sys reorg. And it provides at least one pattern for dealing with stuff that doesn't make sense in some interpreter environments.
Whether some of the APIs make sense depends, well, on the platform you're running on :-)
For example, platform.dist() is defined as returning which *Linux* distribution is used. So on windows, the tuple contains empty strings. (Though I'm not sure why the libc_ver is also returning blanks.)
platform.dist() is an old API. The method to use is platform.linux_distribution(). Most of the APIs allow passing in default values for the case where the module cannot determine the correct values. Most, if not all settings default to empty string, so that it's easy to detect whether there was a problem or not. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Apr 09 2008)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611
participants (2)
-
Jim Jewett
-
M.-A. Lemburg