[Tutor] jython vs CPython... what are the differences?
kent_johnson at skillsoft.com
Tue Oct 26 21:13:07 CEST 2004
There are two main reasons a Python program will not run in Jython.
- Jython implements Python 2.1, so anything introduced in 2.2 or 2.3 is not
supported in Jython.
The best reference for these differences is the "What's New in Python 2.x"
documents available at python.org.
Perhaps the most significant and problematic differences are that Jython
doesn't support new-style classes (inheriting from object) or generators
(functions that use 'yield' to create iterators).
- Jython does not support the full Python standard library.
In general, if it is in the Python 2.1 library and implemented in Python,
it is in Jython
If the Python version is implemented in C, it may or may not be in Jython.
Core modules such as os and re have Jython implementations (written in
Java) but some libraries are missing.
Note: Jython *does* support nested scopes if you put the line
from __future__ import nested_scopes
as the first code line in a module.
At 02:20 PM 10/26/2004 -0400, Rene Lopez wrote:
>I know that speed is often a difference between the two... but what
>else is different?
>I thought I'd try to run one of my scripts through jython just to see
>what happens.. but I get an error from jython, but the code runs just
>fine in regular python. Is there a tutorial out there for porting the
>code over, or a list of things that work in python but not jython?
>Tutor maillist - Tutor at python.org
More information about the Tutor