Several other language implementations of Python

Source: Internet
Author: User
Python itself as a programming language, it has a variety of implementations. The implementation here refers to the Python interpreter and the standard library, which are in line with the Python language specification. These implementations, while implementing the same language, are somewhat different from each other, especially with CPython.

Several major implementations are listed below.

1.CPython: This is the official version of Python, the use of C language, the most widely used, the new language features are generally the first to appear here.

The CPython implementation converts the source file (py file) into a bytecode file (PYc file) and then runs on the Python virtual machine.

2.Jython: This is a Python Java implementation that, compared to CPython, is much more interoperable with the Java language than the CPython and C languages do.

The Java code base can be used directly in Python, which makes it easy to write test code for Java programs and, further, to write GUI programs in Python using a graphics library such as swing.

Jython dynamically compiles the Python code into Java bytecode and then runs the converted program on the JVM, which means that at this point the Python program is no different from the Java program, except that the source code is different.

It is easy to write a class in Python that uses this class like a Java class.

You can even compile the Jython script statically to Java bytecode.

Example code:

From Java.lang import SystemSystem.out.write (' Hello world!\n ')

3.Python for. NET: it is essentially a. NET managed version of CPython implementation that is well interoperable with. NET libraries and program code.

4.IronPython: Unlike python for. NET, it is a Python C # implementation, and it compiles Python code into C # intermediate code (similar to Jython) and then runs it with. NET language interoperability is also very good.

5.PyPy: Python implementation version, the principle is this, pypy run on CPython (or other implementations), the user program runs on the PyPy. One of its goals is to become the test farm of the Python language itself because it is easy to 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 is a limit to the simultaneous function calls, so it is difficult for Python to implement user-level line libraries and complex recursive applications. Once this limit is exceeded, the program crashes. Stackless's Python implementation breaks this limit, and a C stack frame can have any number of Python stack frames. This allows you to have almost infinite function calls and can support a large number of threads. The only problem with stackless is that it will make significant changes to the existing CPython interpreter. So it's almost an independent branch. Another project named Greenlets also supports micro-threading. It is a standard C extension, so there is no need to make any modifications to the standard Python interpreter.

  • 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.