Appendix D. Jython and CPython Differences

Jython is an alternative implementation of the Python language. Although in most cases Jython behavior is identical to CPython, there are still cases where the two implementations differ. If you are already a CPython programmer, or are hoping to use CPython code under Jython, you need to be aware of these differences. This Appendix attempts to categorize known differences between CPython and Jython.

There are several reasons why Jython and CPython differ. Some of the design decisions made to take advantage of Java functionality have led Jython farther away from CPython. And the limitations of the Java platform lead to other differences. Some of these differences will be resolved in the near future, as development continues on both tracks—CPython 2.2 is already scheduled to start to resolve some of the differences about classes and types. Recent design discussions on new CPython features suggest that the Python language is unlikely to make future changes that would be incompatible with Jython. However, there is still a time lag between a new CPython release and the corresponding Jython one. The following list is based on Jython 2.1a3 and CPython 2.1.1.

Jython Extensions


Subclasses of java.lang.Exception can be raised from Jython code using the same syntax and semantics as Jython exceptions. Java exceptions raised from Java code called by Jython can be caught and handled just like Jython exceptions.

False values

In Jython, the following ...

Get Jython Essentials now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.