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

Eric Snow ericsnowcurrently at gmail.com
Wed May 9 16:51:33 CEST 2012


On Wed, May 9, 2012 at 3:57 AM, "Martin v. Löwis" <martin at v.loewis.de> wrote:

Interesting proposal. I have a number of comments:

Thanks for taking a look, Martin.

- namespace vs. dictionary. Barry was using it in the form  sys.implementation.version. I think this is how it should work,  yet the PEP says that sys.implementation is a dictionary, which  means that you would need to write  sys.implementation['version']

 I think the PEP should be silent on the type of sys.implementation,  in particular, it should not mandate that it be a module (else  "from sys.implementation import url" ought to work)  [Update: it seems this is already reflected in the PEP. I wonder where the requirement for "a new type" comes from. I think making it a module should be conforming, even though probably discouraged for cpython, as it would make people think that they can rely on it being a module. I wish there was a builtin class class record:  pass which can be used to create objects which have only attributes and no methods. Making it a type should also work:  class implementation: name = "cpython" version = (3,3,0)  in which case it would an instance of an existing type, namely,  "type"]

The type for sys.implementation has slowly shifted from the original proposal. At this point it's settled into where I think it will stay, a custom type. I've covered the choice of type in the rationale section. However, there may be merit in not being so specific about the type. I'll give that some thought.

- under-specified attributes: "run-time environment" doesn't mean much  to me - my first guess is that it is the set of environment variables,  i.e. a dictionary identical to os.environ. I assume you mean something  different ...  gctype is supposedly a string, but I cannot guess what possible  values it may have. I also wonder why it's relevant.

Sorry for the confusion. These are from the examples section for sys.implementation.metadata. I believe the current version of the PEP is more clear on the distinction.

Thanks again for the feedback.

-eric



More information about the Python-Dev mailing list