Python is a high-level, general-purpose, interpreted language developed by Guido van Rossum, and first released in 1991. It is one of the most popular programming languages due to its broad usage in different technology and clear-cut syntax. Python covers large number of libraries that are applicable from machine learning to web development. So there are different flavors of Python available in order to use its features in other programming languages like Java, C#, Ruby, etc.
Flavors of Python are the different implementations of Python. If we want to use Python with C# .Net framework, then there is IronPython. Similarly, for Java, there is Jython, and for Ruby, RubyPython. These all implementations are possible because of different types of Python compilers that refer to flavors of Python. Python is the language itself, not the implementation. Thus to give the language a medium to connect with CPU, there are different implementations of Python according to other languages use cases.
Flavors of Python
Let’s deep dive into the different flavors of Python available in the market and get knowledge about them. It will be worth understanding those flavors use cases for Pythonists and any other programmers who want to integrate Python in their handy programming language.
CPython is the original Python implementation. It is the implementation that you downloaded from Python official site. CPython is written in C and Python that can be defined as both an interpreter and compiler as it compiles Python code into bytecode before interpreting it. Bytecode is the code that is processed by a program, usually referred to as a virtual machine, rather than by the ‘real’ computer machine, the hardware processor.
CPython introduces the GIL(Global Interpreter Lock) problem on each CPython interpreter due to which parallel processing between threads is not possible.
Global Interpreter Lock: Mechanism used in computer language interpreters to synchronize the execution of threads so that only one thread can execute at a time.
PyPy is an alternative implementation of the Python programming language to CPython(which is the standard implementation). Therefore, Pypy is a replacement for CPython which runs generally faster than CPython.
PyPy uses a JIT(just-in-time) compiler which helps Python programs run faster on it. It supports most of the commonly used Python standard library modules except for code that depends on CPython extensions.
“It you want your code to run faster, you should probablly just use PyPy.”
– Guido Van Rossum(creator of Python)
Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999.
Jython programs can import and use any Java class. Since Jython run over the JVM(Java Virtual Machine) it does not implement a GIL(global interpreter lock) problem, enabling real parallelism using threads.
RubyPython is the implementation of the Python programming language for Ruby platforms. It acts as the bridge between the Ruby and Python interpreters. It allows running Python interpreter inside the Ruby applications.
IronPython is a free and open-source implementation of Python which is tightly integrated with the .NET Framework. It was developed by Mono. Jim Hugunin and first released in 2006. At present, its stable release version is 2.7.11 which was released on 17 Nov 2020.
IronPython is completely written in C# and implemented on top of the Dynamic Language Runtime(DRL) which is part of the .NET Framework 4.0. IronPython provides Python developers the power of .NET Framework features to be used in their projects. Also, .NET developers can use IronPython to get benefits from Python libraries which can be used for embedding and testing purposes.
Python(x,y) is a free scientific and engineering development software based on Python programming language, Qt(graphical user interfaces), and Spyder(interactive scientific development environment). It helps scientific programmers to switch to Python from other languages like C/C++, Fortran, MATLAB, etc. It is mainly used for numerical computations, data analysis, and data visualization.
MicroPython is a lean and fast implementation of the Python programming language that is optimized to run on a microcontroller. It is written in C and compatible with Python 3.
MicroPython pyboard is a small electronic circuit board that runs MicroPython on bare metal and gives a low-level Python operating system that can be used to control all kinds of electronic projects.
Stackless Python is an enhanced version of the Python programming language that does not use the C stack. It allows reaping the benefits of thread-based programming by running hundreds of thousands of tiny tasks, called “tasklets”, in a single main thread. Tasklets are those tasks that run independently on the CPU and can communicate with others via channels.
Using Brython, you can develop an application that runs in the browser using Python programming language. Its speed of execution is similar to CPython for most operations.
Cython is an optimizing static compiler for both the Python programming language and the extended Cython programming language(based on Pyrex). It makes writing C extensions for Python as easy as Python itself.