[stdlib-sig] platform as part of sys (was pypy_vm)

M.-A. Lemburg mal at egenix.com
Wed Apr 9 20:58:41 CEST 2008

On 2008-04-09 20:43, Jim Jewett wrote:
> "M.-A. Lemburg" <mal at 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

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

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

More information about the stdlib-sig mailing list