CPython vs. Jython/JPython

Arnold de Vos adv at langdale.com.au
Wed Nov 1 18:46:57 EST 2000


I don't post to the group much but I *have* to chime in here with a bouquet
for JPython/Jython.   The Java/Python synergy is unique, I know of nothing
like it anywhere else.  You just have to experience it.

In the past, we've implemented a big app in CPython with C extensions and
found it a very fast way to develop clean and reliable software.  We will do
more of that.

But the mixed Java/Python environment is something quite different that I've
never seen before.  You don't write "java extensions" and "Python glue".
You literally mix the two languages on a per-class or per-package basis.

I wonder if this is approximately what Python 3000 could look like where
type-safe and "dynamic-mode" modules are mixed?

- Arnold

---
Arnold deVos
Langdale Consultants
adv at langdale.com.au



Guido van Rossum <guido at beopen.com> wrote in message
news:cpd7gijt1d.fsf at cj20424-a.reston1.va.home.com...
> You are all wrong. :-)
>
> The key difference between CPython and JPython is not speed, but
> available extensions.  CPython is useful as a glue language for C/C++
> library code.  There are lots of examples, e.g. NumPy, Tkinter, PIL,
> and so on.  JPython is useful as a glue language for Java library
> code, e.g. Swing, JavaBeans, Jave 2 Enterprise Edition APIs, and so
> on.
>
> If only CPython existed, linking to Java code would be very
> cumbersome: you'd have to wrap a JVM in a CPython extension and take
> it from there.  If only JPython existed, linking to C/C++ code would
> be impossible (in situations where JNI is not available) or at best
> cumbersome (wrapping C/C++ code in JNI is much more painful than
> writing Python wrappers, because of the JVM's garbage collector).
>
> It's sometimes possible to use C/C++ code from JPython (e.g. Finn Bock
> did a wrapper for _tkinter) but rarely convenient.  I haven't heard of
> anyone linking to a JVM from CPython.
>
> Of course, the fact that there are two different implementations means
> that an app that requires the use of both a library written in C/C++
> and one written in Java is out of luck.  Fortunately, most of the
> standard extensions (e.g. regular expressions) are available in both
> CPython and JPython.
>
> In the rare case where you need two non-standard extensions, you could
> write your program as two communicating processes, one using JPython,
> one using CPython.
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)





More information about the Python-list mailing list