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

Eric Snow ericsnowcurrently at gmail.com
Fri Jun 1 18:28:22 CEST 2012


On Thu, May 31, 2012 at 9:08 PM, Barry Warsaw <barry at python.org> wrote:

On Jun 01, 2012, at 11:49 PM, Nick Coghlan wrote:

The long term goal here is that all the code in the standard library should be implementation independent - PyPy, Jython, IronPython, et al should be able to grab it and just run it. That means the implementation specific stuff needs to migrate into the C code and get exposed through standard APIs. PEP 421 is one step along that road. Exactly.  Or to put it another way, if you implemented sys.implementation in some stdlib Python module, you wouldn't be able to share that module between the various Python implementations.  I think the stdlib should strive for more commonality across Python implementations, not less.  Yes, you could conditionalize your way around that, but why do it when writing the code in the interpreter implementation language is easy enough?  Plus, who wants to maintain the ugly mass of if-statements that would probably require?

Not only that, but any new/experimental/etc. implementation would either have be blessed in that module by Python committers (a la the platform module*) or would have to use a fork of the standard library.

Eric's C code is easily auditable to anyone who knows the C API well enough, and I can't imagine it wouldn't be pretty trivial to write it in Java, RPython, or C#.

And I'm by no means a C veteran. :)

-eric



More information about the Python-Dev mailing list