[Python-Dev] PEP about sys.implementation and implementation specific user site directory (original) (raw)
Christian Heimes lists at cheimes.de
Sat Oct 10 02:24:44 CEST 2009
- Previous message: [Python-Dev] PEP about sys.implementation and implementation specific user site directory
- Next message: [Python-Dev] PEP about sys.implementation and implementation specific user site directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Benjamin Peterson wrote:
sys.implementation is a PyStructSequence that contains various information about the current implementation. Some fields are required to be present on every implementation. Implementations may choose to add additional fields as they see fit. Some fields like compiler are useful for introspection and are already part of sys.version. I like to include them for the sake of completeness. Can we generate sys.version from sys.implementation then?
sys.version is created by Py_GetVersion() which uses Py_GetCompiler() for the compiler information:
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s", PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
For CPython the compiler attribute should be set to the return value of Py_GetCompiler().
sys.userdirsuffix ----------------- Why not site.userdirsuffix?
Because all implementations of Python like to use the same, unpatched site module. The sys module is different for every implementation. It's more convenient to have an attribute on the sys module that can be filled by each implementation. I could also add a lookup table for all known implementations to the site module. But what about unknown or new implementations? They would have to wait until we add a new entry for them. The sys.userdirsuffix is more flexible and future prove.
Christian
- Previous message: [Python-Dev] PEP about sys.implementation and implementation specific user site directory
- Next message: [Python-Dev] PEP about sys.implementation and implementation specific user site directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]