Summary
After nearly six years in the making, the Jython project released the latest version of its Java-based Python implementation, making Jython compatible with Java 6 and Python 2.2.
Advertisement
The Jython project, released Jython 2.2, the first new version of the Java-based Python language implementation in almost six years. Features in Jython 2.2 roughly correspond to features of Python 2.2, according the the projects's documentation.
Jython's three main components are a compiler that compiles Python source code to Java bytecode. Those bytecodes can then directly execute on the JVM. It also provides set of support libraries used by the compiled Java bytecodes. In addition, the distribution provides some extra support to make it easier to invoke classes in Java packages from within Jython.
Key features of the latest release include:
New-style Python classes and their instances are Java serializable
Java collections integration
Completely rewritten socket module and new select module using java.nio which allows the use of SSL and non-blocking sockets.
java.nio exceptions are mapped to their corresponding Python error codes when thrown.
Support for JDK1.5 and 1.6
telnetlib from CPython
xml modules from pyxml
Java collections integration
A new compiler AST
What do you think of Jython as an alternative language in which to write for the JVM?
Most of the changes seems to be under the hood---performance and quality.
Java platform integration is really neat. For example Java collections data types behaves like Python lists and maps in some ways. For instance the iteration with for seems to work with Java list instances. "Stringification" also seems to work.
from java.util import ArrayList l = ArrayList([2,4,6])
print l [ x for x in l ]
One of the reasons I stayed away from Jython for a long time is that the project looked abandoned. I have been tracking the project since it started to come back to life recently.
Most of my Python scripts are not appropriate for Jython (and I use a lot of 2.5 features). The question is whether my use of Python could include other areas currently catered to almost exclusively by Java.
Will there be 2.4 or 2.5 language level support coming up soon?