Introduction
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
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
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
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
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
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)
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
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
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.
Brython
Brython is the implementation of the Python 3 programming language to client-side web programming. Its main goal is to replace Javascript with Python as the scripting language for web browsers.
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.
Pyjs
Pyjs is a rich web application framework for developing client-side web and desktop applications in Python. With the help of Pyjs, we can write JavaScript-powered web applications entirely in Python and the application is compiled as JavaScript codes.
Cython
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.
Conclusion
In this tutorial, we discussed the different flavours of Python available. We know how PyPy could be a good solution to improve the performance of the Python application by using JIT compiler as comparison to Python standard compiler CPython. We also discussed about Python implementation on Java, Javascript, Ruby languages in order to get the features of Python. We know how Python is use as a client-side web programming in order to Javascript by Brython. The flavors we discussed in this tutorial is not complete without their actual implementation. So I suggest you to atleast go to their official site and try to make simple application and get more insights about their use cases in technology.