what is Jython?

Chris Angelico rosuav at gmail.com
Thu Jan 8 23:50:20 EST 2015


On Fri, Jan 9, 2015 at 3:10 PM, Brian <bclark at es.co.nz> wrote:
> I tried to find out more on the internet but didn't have much success. All
> I know is that its a combination of Python and Java.
> Is it more Java than Python or the other way around?
> Is Jython free like Python?
> Is the programming language for Jython similar to Python or similar to
> Java?
> Are there pros and cons then switching from Python to Jython?

The most common Python interpreter is "CPython", which is the one you
get when you go to the main downloads page on python.org. But Python,
the language, is quite separate from CPython, the implementation, and
there are a number of other implementations of the same language. In
theory, a Python script should run on any Python interpreter. Jython
is a Python interpreter written in Java; IronPython is a Python
interpreter written in C# (I think; uses .NET or Mono, anyway). PyPy
is a Python interpreter written in Python. MicroPython or uPy is a
cut-down Python interpreter designed for embedded systems. Brython is
a Python interpreter designed to go in a web browser.

Jython is free software, just as CPython is. I don't know the details
of the licenses, and IANAL, but I know the intention is that it's free
software. The code you run in Jython will be broadly the same as the
code you'd run in CPython, but some of the modules available in
CPython aren't available in Jython, and vice versa. The main reason
for choosing Jython is that you can load up a Java class and call on
its methods; you can either use an existing Java module and write your
application in Jython, or you can write a module in Jython, compile it
to a .class file, and then load that up from a Java program. With
CPython, on the other hand, it's really easy to interface with C code
(or other languages that compile to machine code), so it's easy to
make use of a typical Unix library.

Jython isn't a combination of Python and Java; it's Python,
implemented in Java. Does that answer your question?

ChrisA



More information about the Python-list mailing list