Jython: Love and Hate

Posted by Eric Stein - February 7, 2011 CE @ 06:26:02 UTC
From my experiences using Jython to work with the DyIO, I learned a fair bit about what it's like to work with Jython today. I ran into issues with older versions of Jython not supporting generator functions (yield syntax) so I upgraded to the latest (as of today), 2.5.2rc3.

The 'batteries' that I've become accustomed to with CPython - the standard implementation - mostly exist, but are subtly different here and there. I won't go into details, as I don't have a bone to pick. The issues I see here are that there are areas of the Python language/runtime that are not very precisely specified, and as such, will be implemented differently by other implementors. This results in modules written against CPython will often fail in strange ways on Jython.

In my work, I solved some of these issues by adding the CPython site-packages and python-support directories to sys.path, but that's not perfect, and could even result in errors in code built for the Jython platform initially. I would like to see a world where pure python applications will run on either without issues, but that's not the world we have today.

I originally intended to run my whole project on Jython as a learning experience and to evaluate its performance, but I ended up writing a simple TCP/JSON API (my preferred serialization library didn't run well on Jython, so I had to use JSON) to abstract away the parts of my project that required Jython into a separate daemon; I didn't want to run everything under Jython anymore as it was causing periodic headaches. Incidentally, for my application, it's useful to have that separation so as to not require local hardware.

In short, Jython saved me a lot of trouble and is a new and useful wrench in my toolbox, but I'm a bit disappointed in the level of CPython compatibility that it has.
Last Edited February 7, 2011 CE @ 06:29:53 UTC


There are no comments yet.

Post a Comment

Email (not published, I won't spam you)
URL (optional)
2 + 2?
Worth Saying
Valid XHTML, CSS, RSS | 3ms | Copyright 2004-2021 Eric Stein