What is Jython and is it useful at all? [closed]

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago .

Please detail it out! thanks.

8,081 9 9 gold badges 42 42 silver badges 72 72 bronze badges asked Dec 7, 2009 at 13:08 269k 361 361 gold badges 793 793 silver badges 1.1k 1.1k bronze badges

10 Answers 10

Jython, successor of JPython, is an implementation of the Python programming language written in Java.

As for what uses it may have:

Jython programs can seamlessly import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules.

Performance measurements of Jython, IronPython and CPython show that both Jython and IronPython outperform CPython for some cases with large datasets.

answered Dec 7, 2009 at 13:10 352k 86 86 gold badges 698 698 silver badges 694 694 bronze badges

Jython doesn't compile to bytecode the same way Java does. The bytecode does all the wonderful dynamic runtime things that CPython does, so is considerably slower than Java.

Commented Dec 7, 2009 at 13:24

If you know Python and has bought into the "pythonic" way of doing things, then Jython allows you to bring that philosophy to the JVM stack. If you do this, it is much more than just adding scripting capability.

In our latest projects, all the custom and business logic is built in Jython, at the same time we can still leverage some of the great tried and tested Java libraries like Solr, Jasperreports, Quartz, Jetty, Velocity to name a few.

It does get compiled to bytecode, however, an extra layer is being added, but is no different to using an ORM instead of straight JDBC for example.

What you gain in productivity far out weighs the minuscule lost in performance.

On the server side, Jython is rarely the bottleneck. For mini desktop apps, there may be issues, but very much dependent on what you are trying to do.

The latest JDK, together with containers like Jetty or Tomcat are very mature and stable, adding Python on top, in many cases, gives the best of both worlds.