Several other languages of Python implement _python

Source: Internet
Author: User
Tags in python

Python itself as a programming language, it has a variety of implementations. The implementation here refers to the Python interpreter and the standard library that conform to 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, using the C language, the most widely used, new language features are generally the first to appear here.

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

2.Jython: This is the Java implementation of Python, which is much more interoperable than CPython with the Java language than the CPython and C languages.

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

Jython will dynamically compile the Python code into Java bytecode and then run the converted program on the JVM, which means that the Python program is no different from the Java program, except for the source code.

It's easy to write a class in Python, and use it like a Java class.

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

Sample code:

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

3.Python for. NET: it is essentially a. NET managed version of the CPython implementation, which is very interoperable with. NET libraries and program code.

4.IronPython: Unlike python for. NET, it is a C # implementation of Python, 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's Python implementation version, the principle is that PyPy runs on CPython (or other implementations), and the user program runs on top of PyPy. One of its goals is to become a test ground for the Python language itself, as 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 every Python function call produces a C function call. This means that the resulting function calls are limited, so it is difficult for Python to implement user-level line threading and complex recursive applications. Once this limit is exceeded, the program crashes. The stackless Python implementation breaks this limit, and a C stack frame can have any number of Python stack frames. This allows you to have almost unlimited 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.