[Python-ideas] PEP 4XX: Adding sys.implementation

M.-A. Lemburg mal at egenix.com
Thu May 3 10:20:39 CEST 2012


Some corrections to the PEP text:

platform.python_implementation()
--------------------------------

The following text in the PEP needs to be updated:

"""
The platform module guesses the python implementation by looking for
clues in a couple different sys variables [3]. However, this approach
is fragile.
"""

Fact is, that sys.version parsing is documented to be done by the
platform module (see the docs on sys.version), so implementations
are free to provide patches in case they choose different ways of
formatting sys.version.

A sys.implementation record would make things easier for the platform
module, though, so it's an improvement.

sys.version
-----------

sys.version is defined as "A string containing the version number
of the Python interpreter plus additional information on the build
number and compiler used. This string is displayed when the interactive
interpreter is started. Do not extract version information out of it,
rather, use version_info and the functions provided by the platform module.

It's not defined as "version of the Python language" as the PEP
appears to indicate.

Other things:

Making sys.implementation a dictionary
--------------------------------------

This is not a good idea, since it allows for monkey-patching
the values and will also result in new undocumented or per-implementation
keys.

Better use a namedtuple like we do for all other such informational
resources.

sys.implementation information
------------------------------

While I'm not sure whether details such as VCS URLs and revision ids
should really be part of a data structure that is supposed to
identify the implementation (sys.version is better for that),
if you do want to add such information, then please add all of it,
not just part of the available build information.

See platform._sys_version() returns (name, version, branch, revision,
buildno, builddate, compiler).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 03 2012)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2012-04-26: Released mxODBC 3.1.2                 http://egenix.com/go28
2012-04-25: Released eGenix mx Base 3.2.4         http://egenix.com/go27

::: Try our new mxODBC.Connect Python Database Interface 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
               http://www.egenix.com/company/contact/



More information about the Python-ideas mailing list