[Python-Dev] a new type for sys.implementation (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Thu May 31 14:31:10 CEST 2012


On Thu, May 31, 2012 at 8:26 PM, Mark Shannon <mark at hotpy.org> wrote:

Eric Snow wrote:

The implementation for sys.implementation is going to use a new (but "private") type[1].  It's basically equivalent to the following: Does this really need to be written in C rather than Python?

Yes, because we want to use it in the sys module. As you get lower down in the interpreter stack, implementing things in Python actually starts getting painful because of bootstrapping issues (e.g. that's why both _structseq and collections.namedtuple exist).

Personally, I suggest we just expose the new type as types.SimpleNamespace (implemented in Lib/types.py as "SimpleNamespace = type(sys.implementation)" and call it done.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list