Several implementations of Python

Source: Internet
Author: User

Python itselfProgramming LanguageIt has multiple implementations. The implementation here refers to the python interpretation that complies with the Python language specifications.ProgramAnd the standard library. Although these implementations implement the same language, there are still some differences between them, especially cpython.

The following lists several major implementations.

1. cpython: this is an official version of Python. It is implemented in C language and is most widely used. New language features are generally first introduced here.

Cpython converts the source file (py file) to a bytecode file (PyC file) and runs on the python virtual machine.

2. jYthon: This is the JAVA Implementation of Python. Compared with cpython, the interoperability between ython and Java is much higher than that between cpython and C.

Java can be used directly in Python.CodeLibrary, which allows python to easily write test code for Java programs. Furthermore, you can use swing and other graphics libraries in Python to write GUI programs.

Jython will dynamically compile the Python code into a Java bytecode, and then run the converted program on the JVM. This means that the python program is no different from the Java program,Source codeDifferent.

Writing a class in python is easy to use like using a Java class.

You can even statically compile Jython scripts into Java bytecode.

Sample Code:

 
FromJava. LangImportSystemsystem. Out. Write ('Hello world! \ N')

3. python for. Net: it is essentially a. Net managed version implemented by cpython. It has good interoperability with the. Net Library and program code.

4.Ironpython: different from Python. net, which is the C # Implementation of Python, And it compiles the Python code into the C # intermediate code (similar to Jython), and then runs it. NET language is also very good in interoperability.

5.Pypy: Python implementation version. The principle is as follows: pypy runs on cpython (or other implementations) and the user runs on pypy. One of its goals is to become a test ground for the Python language itself, because it can easily modify the implementation of the pypy interpreter (because it is written in Python ).

6.Stackless: one limitation of cpython is that each Python function call produces a C function call. This means that there are limits on function calls at the same time. Therefore, it is difficult for python to implement user-level thread libraries and complex recursive applications. Once this restriction is exceeded, the program will crash. Stackless Python implementation breaks through this restriction. a c stack frame can have any number of Python stack frames. In this way, you can have almost infinite function calls and support a large number of threads. The only problem with stackless is that it needs to make major changes to the existing cpython interpreter. Therefore, it is almost an independent branch. Another project named greenlets also supports micro-threads. It is a standard C extension, so there is no need to make any changes to the standard Python interpreter.

The following articleArticleI have made many introductions to stackless, but it is hard to understand:

Cute Python: Python implementation

 

 

Related Article

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.