O'Reilly    
 Published on O'Reilly (http://oreilly.com/)
 See this if you're having trouble printing code examples


JPython: The Felicitous Union of Python and Java

Frankly Speaking today moves boldly into a new area: touting a book which the author of Frankly Speaking edited, himself! Aside from the obvious benefit of shameless self-promotion, I justify including this excerpt from Learning Python, by Mark Lutz and David Ascher, because it demonstrates an interesting new development: tools, even versions of scripting languages, aimed for Java as a development platform.

Java can be so many things: language, environment, technology, product, even, someday, an operating system. To an increasing number of programmers these days, Java is most interesting as a development platform. Whether Java succeeds as the next important development layer, it is certainly an interesting competitor to the usual machine-dependent, operating-system environments for which applications are currently developed. Open-source scripting languages are drawn to Java because it supports networks and the Web so well, extending the power of their languages. And Java developers will be drawn to the use of scripting languages because these languages hide some of the complexity inherent in Java. Perl, Tcl, and Python (and many other scripting languages as well) have begun paying serious attention to Java as an interesting place to port their languages.

Java programmers understand the value of abstraction; Java's promise is to provide a "write once, run everywhere" environment by providing a level of abstraction that hides the complexity and differences among popular operating systems. Java programmers, therefore, ought to appreciate the advantages afforded them by a new port of Python called JPython.

JPython works much like regular Python, one of the most popular open-source scripting languages, but in addition provides easy access to Java libraries. Access to those libraries is easy because JPython understands the structure of Java libraries and does a lot of work "behind the scenes". As you'll see in the book excerpt I link to below, Java programmers can also use JPython as a Rapid Application Development for exploring Java libraries. Just as Java provides an abstract layer over operating systems, JPython provides an easy-to-use, interactive environment that makes Java programming easy. The example in this excerpt shows how JPython can work with Java Swing to produce real applications with less code.

This excerpt is called JPython: the Felicitous Union of Python and Java. It comes from the book Learning Python, by Mark Lutz and David Ascher, published by O'Reilly. I think that when you're finished reading it, you'll have a sense of the felicity promised in the title.

Frank Willison
Editor-in-Chief

Return to: Frankly Speaking

Copyright © 2009 O'Reilly Media, Inc.