Introduction to CPython and Jython comparison

Source: Internet
Author: User

CPython

When we downloaded and installed Python 3.x from the official Python website, we immediately got an official version of the interpreter: CPython. This interpreter was developed in C language, so called CPython. Running Python at the command line is the start of the CPython interpreter.

CPython is the most widely used Python interpreter. All the code for the tutorial is also executed under CPython.

Jython is a Python interpreter running on the Java platform that compiles python code directly to Java bytecode execution.

The standard version of Python is compiled with C, also known as CPython.

There is also a Python interpreter that is written entirely in Java, called Jython.

There are some subtle differences between the two interpreters, but they are very close and the startup environment is identical.

In general, Python is CPython, which is compiled with C, which supports the extension of C and does not support Java extensions.

Jython, a python implemented with Jpython, supports Java extensions that can run Jython as long as there is a Java virtual machine, with the ability to access Java packages and class libraries, and to provide access to Java native exception handling , inheriting the characteristics and introspection ability of JavaBeans. Encouraging Python to Java development, the Jython program can be seamlessly integrated with Java. In addition to some standard modules, Jython uses Java modules. Jython has almost all the modules in the standard Python that do not depend on the C language. For example, GUI developers can access the Java awt/swing Library, and Jython's user interface will use SWING,AWT or SWT. Jython can be dynamically or statically compiled into Java bytecode.

Jython also includes Jythonc, a compiler that translates python code into Java code. This means that Python programmers can use a class library that they write in Python code in a Java program.

Current situation and future

The current Jython version is Jython-2.7.0. It improves integration with Java and implements the functionality of CPython 2.5

Advantages of Jython

Jython greatly reduces the amount of programming code compared to similar Java programs.

Jython provides a scripting engine for the Java development environment, makes it easy to test the Java class Library, and has both an interpreter and a compiler to test program code without compiling, leveraging the Java native garbage collector (CPython does not implement this feature).

?

Introduction to CPython and Jython comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.