Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83402 > unrolled thread

what is Jython?

Started byBrian <bclark@es.co.nz>
First post2015-01-09 04:10 +0000
Last post2015-01-10 03:15 +1100
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  what is Jython? Brian <bclark@es.co.nz> - 2015-01-09 04:10 +0000
    Re: what is Jython? Chris Angelico <rosuav@gmail.com> - 2015-01-09 15:50 +1100
      Re: what is Jython? Grant Edwards <invalid@invalid.invalid> - 2015-01-09 16:06 +0000
        Re: what is Jython? Chris Angelico <rosuav@gmail.com> - 2015-01-10 03:15 +1100

#83402 — what is Jython?

FromBrian <bclark@es.co.nz>
Date2015-01-09 04:10 +0000
Subjectwhat is Jython?
Message-ID<509995943442469175.487823bclark-es.co.nz@free.teranews.com>
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?


-- 
Regards Brian

[toc] | [next] | [standalone]


#83403

FromChris Angelico <rosuav@gmail.com>
Date2015-01-09 15:50 +1100
Message-ID<mailman.17505.1420779030.18130.python-list@python.org>
In reply to#83402
On Fri, Jan 9, 2015 at 3:10 PM, Brian <bclark@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

[toc] | [prev] | [next] | [standalone]


#83454

FromGrant Edwards <invalid@invalid.invalid>
Date2015-01-09 16:06 +0000
Message-ID<m8ouam$brp$1@reader2.panix.com>
In reply to#83403
On 2015-01-09, Chris Angelico <rosuav@gmail.com> wrote:

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

Just to clarify, Jython 

  1) is a Python compiler that compiles Python source code into JVM
     bytecode (class, jar, whatever) that runs on a standard Java
     runtime. Python programs compiled with Jython can call standard
     Java libraries and and can call or be called by code written in
     Java.

  2) is a Python compiler that is written in Java.

AFAK, these are in principal orthogonal.  Number 1) is the important
part and does not require that 2) be true.  The Jython compiler could
(in theory) be implemented in C, Fortran, or BASH, but there are some
practical advantages to using Java to write a compiler that generates
JVM bytecode.

-- 
Grant Edwards               grant.b.edwards        Yow! RELATIVES!!
                                  at               
                              gmail.com            

[toc] | [prev] | [next] | [standalone]


#83455

FromChris Angelico <rosuav@gmail.com>
Date2015-01-10 03:15 +1100
Message-ID<mailman.17533.1420820134.18130.python-list@python.org>
In reply to#83454
On Sat, Jan 10, 2015 at 3:06 AM, Grant Edwards <invalid@invalid.invalid> wrote:
> Just to clarify, Jython
>
>   1) is a Python compiler that compiles Python source code into JVM
>      bytecode (class, jar, whatever) that runs on a standard Java
>      runtime. Python programs compiled with Jython can call standard
>      Java libraries and and can call or be called by code written in
>      Java.
>
>   2) is a Python compiler that is written in Java.
>
> AFAK, these are in principal orthogonal.  Number 1) is the important
> part and does not require that 2) be true.  The Jython compiler could
> (in theory) be implemented in C, Fortran, or BASH, but there are some
> practical advantages to using Java to write a compiler that generates
> JVM bytecode.

Indeed. The point of Jython is that it compiles to Java byte-code,
putting it on par with languages like NetRexx as alternative ways to
create .class files.

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web