[Python-Dev] a new type for sys.implementation

Mark Shannon mark at hotpy.org
Fri Jun 1 13:49:16 CEST 2012


Nick Coghlan wrote:
> On Fri, Jun 1, 2012 at 7:16 PM, Maciej Fijalkowski <fijall at gmail.com> wrote:
>>> sys.implementation could be added by site or some other startup file.
>>>
>> Yes, why not do that instead of a new thing in C? I don't care about PyPy
>> actually (since we kind of have to implement sys.implementation in
>> python/RPython anyway, since it'll be different)
> 
> The idea is that sys.implementation is the way some interpreter
> internal details are exposed to the Python layer, thus it needs to
> handled in the implementation language, and explicitly *not* in Python
> (if it's in Python, then the implementation has to come up with some
> *other* API for accessing those internals from Python code, thus
> missing a large part of the point of the exercise).

Why?

What is wrong with something like the following (for CPython)?

class SysImplemention:
     "Define __repr__(), etc here "
     ...

sys.implementation = SysImplemention()
sys.implementation.name = 'cpython'
sys.implementation.version = (3, 3, 0, 'alpha', 4)
sys.implementation.hexversion = 0x30300a4
sys.implementation.cache_tag = 'cpython-33'

Also, should the build/machine info be removed from sys.version
and moved it to sys.implementation?

Cheers,
Mark.



More information about the Python-Dev mailing list