[Python-Dev] sys.implementation

Eric Snow ericsnowcurrently at gmail.com
Wed May 9 05:03:06 CEST 2012

On Tue, May 8, 2012 at 7:14 PM, Barry Warsaw <barry at python.org> wrote:
> Hi Eric,
> Great job on the latest PEP 421.  I really like it.

Encouragement appreciated.  :)

>  A few additional
> comments/questions.
>  * sys.implementation.version
>   This is defined as the version of the implementation, while
>   sys.version_info is the version of the language.  The semantics of
>   sys.version_info have been sufficiently squishy in the past, as the XXX
>   implies.  This PEP shouldn't try to untangle that, so I think it be better
>   to represent both values explicitly in sys.implementation.

Definitely tangled.  So, sys.implementation.version and
sys.implementation.lang_version?  Also, my inclination is to not have
a sys.version equivalent in sys.implementation for now, in the
interest of keeping things as bare-bones as possible to start.

>  * Adding new required variables.  I'd claim that it's not unduly heavyweight
>   to require a new PEP to add required variables to sys.implementation.  That
>   hypothetical PEP will have to include things like rationale, impact on
>   other implementations, etc.  That seems like enough to warrant a new PEP,
>   even if it's relatively succinct.

Agreed.  I'll go with that for the PEP.

>   I'd also make it clear that adding new variables to
>   sys.implementation.metadata explicitly does *not* require a PEP.

Good point.

>  * In Example Metadata Value:
>   "If they later have meaningful uses cases, they can be added by following
>   the process described in Adding New Required Attributes."
>   I'd rephrase this to "If these or any other variables are deemed to have
>   meaningful use cases across all implementations, they can be moved or added
>   to sys.implementation directly, following the process described in Adding
>   New Required Attributes."

That's an important distinction.  I'll clean it up.

>  * I mildly prefer sys.implementation.name to be lower cased.  My intuition is
>   that to be safe, most comparisons of the value will coerce to lower case,
>   which is easy enough in Python, but perhaps a bit more of a pain in C.  I
>   don't feel really strongly about this though.  (A counter argument is that
>   the value might be printed, so a case-sensitive version would be better.)

I'm not sure it makes a lot of difference.  Since cache_tag will be
provided by the implementation, I don't have any strong use-cases that
would constrain the name itself.  Still, my preference is for lower
case as well.  I'll mull this one over.

>  * Since I'm advocating to be explicit about the language version and the
>   implementation version, .hexversion is probably also useful for both.

That's fine with me, and pretty trivial to do.

>  * I've said before that I think the keys in sys.implementation should be
>   locked down (i.e. not writable).

I've been on and off about this.  It's certainly not too hard to do,
it makes sense, and I don't see a lot of reason not to do it.  I'll
give it a go.

> I think sys.implementation.metadata
>   should be the same type.

This I wonder about.  The more I think about it, the more it fits.
I'll give it a day and if that still holds I'll work it in.

Thanks for the feedback, Barry!  Feels like the PEP's getting close.


More information about the Python-Dev mailing list