See All Titles |
![]() ![]() SummaryJPython is a Java implementation of the object-oriented scripting language Python that has been certified as 100% pure Java. Both CPython and JPython are implementations of the same language: Python. Even though the development team tries to make both codes as compatible as possible, differences are inevitable. Each one of these languages is written using a different programming language: C and Java, respectively. Note that JPython re-implements the CPython parser and interpreter in Java. JPython has a set of features that include high-level built-in data types, dynamic typing, optional static compilation, Java classes and packages support, a set of support libraries, and interactive compilation direct to Java bytecodes. JPython, as Java, uses its own environment variable namespace. The reason for that is because there isn't a standard cross-platform way to handle environment variables. Windowing applications are written in JPython using the same set of options that you have available for Java applications. Currently, the two names that you will hear most for this kind of implementation are awt and swing. As JPython and Java are extremely close to each other, it is not that difficult to believe that you can embed JPython code inside a Java application, as well as embed Java code directly into your JPython applications. Both types of implementation are easily supported and coded. The JPython distribution provides a tool called jpythonc that works like a Python compiler for Java. Therefore you can write your code in JPython, and later use jpythonc to generate a simple class, a JavaBean, a servlet, or an applet.
|
© 2002, O'Reilly & Associates, Inc. |