[Python-Dev] Merging Jython code into standard Lib [was Re: Python Language Summit at PyCon: Agenda]

Nick Coghlan ncoghlan at gmail.com
Sat Mar 2 16:17:35 CET 2013

On Fri, Mar 1, 2013 at 6:35 AM, Brett Cannon <brett at python.org> wrote:
> On Thu, Feb 28, 2013 at 3:17 PM, fwierzbicki at gmail.com
> <fwierzbicki at gmail.com> wrote:
>> On Thu, Feb 28, 2013 at 12:00 PM, Antoine Pitrou <solipsis at pitrou.net>
>> wrote:
>> > IMHO, we should remove the plat-* directories, they are completely
>> > unmaintained, undocumented, and serve no useful purpose.
>> Oh I didn't know that - so definitely adding to that is right out :)
>> Really for cases like Jython's zlib.py (no useful code for CPython) I
>> don't have any trouble keeping them entirely in Jython. It just would
>> have been fun to delete our Lib/ :)
>> It would be nice in this particular case if there was a zlib.py that
>> imported _zlib -- then it would be easy to shim in Jython's version,
>> whether it is written in a .py file or in Java.
> That should be fine as that is what we already do for accelerator modules
> anyway. If you want to work towards having an equivalent of CPython's
> Modules/ directory so you can ditch your custom Lib/ modules by treating
> your specific code as accelerators I think we can move towards that
> solution.

I'd go further and say we *should* move to that solution.

Here's an interesting thought: for pure C modules without a Python
implementation, we can migrate to this architecture even *without*
creating pure Python equivalents. All we shou;d have to do is change
the test of the pure Python version to be that the module *can't be
imported* without the accelerator, rather than the parallel tests that
we normally implement when there's a pure Python alternative to the
accelerated version. (There would likely still be some mucking about
to ensure robust pickle compatibility, since that leaks implementation
details about exact module names if you're not careful)

PyPy, Jython, IronPython would then have RPython, Java, C# versions,
while CPython has a C version, and the test suite should work
regardless. (If PyPy have equivalents in Python, they can either push
them upstream, overwrite the "import the accelerator" version).


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

More information about the Python-Dev mailing list