JPython?

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Wed Oct 13 18:18:53 EDT 1999


>>>>> "DS" == Dan Star <danstar at execpc.com> writes:

    DS> Let me see if I am understanding what JPython is.  Is it a
    DS> just-in-time compiler that translates python code to java
    DS> byte-code so that the python code can run in a WEB browser
    DS> that supports java?

Sort of.  Yes, part of what it does is translate Python source code to
Java bytecode, dynamically loading said bytecode into your JVM, and
executing it.  It isn't limited to a browser, and in fact works well
with most 1.1 and 1.2 JVMs (modulo your favorite JIT bugs).
    
    DS> If so, I would assume this places many restricitions on the
    DS> Python language elements you can use.

Actually it doesn't.  I think it's a testament to JimH that JPython
implements very nearly the same language spec that CPython does.  For
a mostly up-to-date comparison, please see

    http://www.jpython.org/docs/differences.html

Most of these are IMO mostly below the radar of the average Python
hacker.  The most significant difference is in the libraries.
Anything that's written in pure Python should work the same in both
implementations.  CPython of course has a host of built-in modules
implemented in C.  Some of these have been ported to Java and are
available in JPython, but not all (contributions welcome!).  Of course
JPython has access to the vast array of Java libraries, which CPython
does not.
    
    DS> Or is JPython a seperate implementation of Python with its own
    DS> language set?

JPython is a completely separate implementation, but it should feel
very natural to any Python programmer.  It is interesting how this
second implementation helps to delineate exactly what is part of
the Python language definition, and what are implementation details.

Hope that helps,
-Barry




More information about the Python-list mailing list