Colors of Python Interpreters by@exactor

Colors of Python Interpreters

tldt arrow
Read on Terminal Reader

Too Long; Didn't Read

CPython is a reference implementation of the Python interpreter under the guidance of Guido van Rossum. It is best described as a mixture of interpreter and compiler, as the code you write is converted to bytecode. Other Python implementations include Jython, IronPython and PyPy. PyPy is written in Python itself and is an alternative to CPython. Stackless is a version of Python that avoids the use of the standard call stack in favor of its own stack. It adds microthreads to the standard Python standard operating system.
featured image - Colors of Python Interpreters
Maksim Kuznetsov HackerNoon profile picture

@exactor

Maksim Kuznetsov

Development Lead.

About @exactor
LEARN MORE ABOUT @EXACTOR'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

As you know, Python is a very popular language and takes 1st place in the TIOBE rating. And in the classical understanding of Python, in 90% of cases, CPython is meant. It is a reference implementation of the interpreter under the guidance of Guido van Rossum. Version 3.10 is current as of November 14, 2021. By now, Python means only version 3, but before this version appeared, mentions of version 2 can still be found.

Now version 2 is not supported and most companies are removing the remnants of the code from version 2 by porting the code to version 3. As of January 1, 2020, Python 2 is no longer supported. And this is quite understandable since, after the release of Python 3 in 2006, developers had to support 2 versions at the same time, which is laborious.

As you might guess from the name CPython, the implementation is written in C. Again, this is a reference implementation that is familiar to everyone who has written in Python. The choice of the C language is an excellent solution for writing interpreters due to its well-known speed of work.

CPython is best described as a mixture of interpreter and compiler, as the code you write is converted to bytecode. By bytecode, we mean program code that is compiled and converted into a low-level language, which, in turn, can be used as a set of instructions for the interpreter. It is this bytecode that is executed on the CPython virtual machine.

Since it is a native Python implementation, CPython is most compatible with packages and language modules. This implementation is the best choice if you need to write code that fully conforms to Python standards.

What about other implementations? There are also implementations for other programming languages of the Python interpreter, such as Jython, IronPython. They are implemented in languages such as Java and C #, respectively.

1. Jython

image

Jython is another Python implementation. It was written in Java and runs on Java platforms. As in CPython, the source code is converted to bytecode - a set of instructions for the interpreter. Jython runs on a given machine, which uses the same environment like Java. This implementation provides convenient work with Java programs. You can easily call and use your Java functions and classes directly from Jython. This gives Python users access to a huge ecosystem of libraries and frameworks, Java users.

Jython current status:

  • Repository: Link
  • Status: maintained, not abandoned (11-20-2021)
  • Interpreter version: 2.7.2
  • Last Release Date: March 21 2020

2. IronPython

image

IronPython is a popular implementation written in C #. It was developed to run on the .NET platform. It creates a bridge to the .NET universe, giving Python users access to C # functions and classes, libraries, and .NET frameworks right from IronPython. This implementation is great for multi-threaded programs. You can find it on the official website - ironpython.net.

IronPython current status:

  • Repository: Link
  • Status: maintained, not abandoned (11-10-2021)
  • Interpreter version: 3.4.0-alpha
  • Last Release Date: April 20 2021

3. PyPy

image

This implementation is written in Python itself and is an alternative to CPython. PyPy was written taking into account all the peculiarities of the Python language, so it is most compatible with CPython. This allows web frameworks like Django and Flask to run. PyPy uses the concept of JIT compilation (Just-in-time), which allows you to compile source code right at runtime. This makes PyPy several times faster than CPython. Many users of the latter complained precisely about the low execution speed. Thus, PyPy completely improves on this part of CPython.

Pypy current status:

  • Repository: Link
  • Status: maintained, not abandoned (11-19-2021)
  • Interpreter version: 3.8
  • Last Release Date: October 25 2021

4. Stackless Python

Stackless Python, or simply Stackless, is a version of the Python programming language interpreter, so named because of the refusal to use the standard C call stack in favor of its own stack. The most impressive feature of Stackless is microthreads, which avoid the overwhelming use of system resources inherent in standard operating system threads. In addition to the standard Python capabilities, Stackless adds support for coroutines, communication channels, and task serialization.

The Stackless interpreter manages microflows on its own. This helps to reduce the overhead of system resources for threads and can significantly reduce the load on the CPU in some situations where the number of threads is very large.

Due to the significant number of source changes, the original CPython Stackless cannot be installed as a library or interpreter extension, so it is distributed as a separate Python interpreter. Interesting fact: Civilization 4, or rather, most of the logic of this game was written in stackless python.

Stackless Python current status:

  • Repository: Link
  • Status: maintained, not abandoned (08-11-2021)
  • Interpreter version: 3.9-alpha
  • Last Release Date: August 12 2021

Source: https://en.wikipedia.org/wiki/Stackless_Python

5. JupyterLite

image

Separately, I would like to mention Jupyter, although it is not a full-fledged interpreter, but only a wrapper for the convenient work of Data Scientists, but I will highlight the Lite version. As far as I know, the “classic” version works in client-server mode, while the Lite version is compiled in WASM and allows you to use it without a server.

The Python interpreter is hardcoded directly into the WASM file and allows you to work without constant calls to the server. Of the minuses - everything is limited only by your hardware, and the browser also eats up its own piece of RAM. But you can always configure a regular Jupyter with a remote connection to a more productive server and run the code there, but you can design using fewer data and, after debugging, test it on the cluster.

JupyterLite current status:

  • Repository: Link
  • Status: actively supported and developed (11-19-2021)
  • Interpreter version: 3.9.5
  • Last Release Date: November 3 2021

Final Thoughts

In this article, I wanted to expand my view of the Python interpreter a little and show that there are also other interpreters of the same language with their peculiarities and interesting features. Sitting down to write an article, I remembered the research, 1-2 years ago on the same topic and was very amazed to see new commits in the Jython and IronPython repositories.

Then I ranked them as irrelevant and abandoned projects, but now they seem more viable than before, I hope that they will continue to exist and will be able to gather around them a community that will maintain and update versions close to the current version of Python.

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa