[Python-Dev] sys.implementation (original) (raw)

Barry Warsaw barry at python.org
Wed May 9 18:39:35 CEST 2012


On May 08, 2012, at 09:03 PM, Eric Snow wrote:

This is defined as the version of the implementation, while sys.versioninfo is the version of the language.  The semantics of sys.versioninfo 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.langversion? 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.

I think it would be fine, if PEP 421 was clear about the semantics of sys.implementation.version and was silent about trying to disentangle the semantics of sys.version. IOW, the PEP can say that the semantics of sys.version are fuzzy, but not try to clear it up. Then it would be explicit (as it already is) that sys.implementation.version describes the version of the implementation, not the version of the language compliance.

If the latter is useful later, then it can use the PEP 421 described process to propose a new sys.implementation value that describes a language compliance variable.

 * 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 cachetag 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.

Cool. As I said, I'm on the fence about it too. :)

 * 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.

Maybe it doesn't matter. We're all adults here. I think there are two good choices. Either the PEP explicitly describes sys.implementation as immutable, or it is silent about it. IOW, I don't think the PEP should explicitly allow sys.implementation to be mutable.

 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.

Cool.

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

Indeed!

Cheers, -Barry



More information about the Python-Dev mailing list