[Python-ideas] sys.implementation

Eric Snow ericsnowcurrently at gmail.com
Tue Apr 24 08:42:54 CEST 2012

On Mon, Mar 19, 2012 at 10:41 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> In October 2009 there was a short flurry of interest in adding
> "sys.implementation" as an object to encapsulate some
> implementation-specific information [1].  Does anyone recollect where
> this proposal went?  Would anyone object to reviving it (or a
> variant)?

The premise is that sys.implementation would be a "namedtuple" (like
sys.version_info).  It would contain (as much as is practical) the
information that is specific to a particular implementation of Python.
 "Required" attributes of sys.implementation would be those that the
standard library makes use of.  For instance, importlib would make use
of sys.implementation.name (or sys.implementation.cache_tag) if there
were one.  The thread from 2009 covered a lot of this ground already.

Here are the "required" attributes of sys.implementation that I advocate:

* name (mixed case; sys.implementation.name.lower() used as an identifier)
* version (of the implementation, not of the targeted language
version; structured like sys.version_info?)

Here are other variables that _could_ go in sys.implementation:

* cache_tag (e.g. 'cpython33' for CPython 3.3)
* repository
* repository_revision
* build_toolchain
* url (or website)
* site_prefix
* runtime

Let's start with a minimum set of expected attributes, which would
have an immediate purpose in the stdlib.  However, let's not disallow
implementations from adding whatever other attributes are meaningful
for them.


[1] http://mail.python.org/pipermail/python-dev/2009-October/092893.html

More information about the Python-ideas mailing list