Exploring the World of Python

Exploring the World of Python

Zaphnath Paaneah


Python aka CPython

Cython


In addition to Python 2 and Python 3, there is more than one version of each.

First of all, there are the Pythons which are maintained by the people gathered around the PSF (Python Software Foundation), a community that aims to develop, improve, expand, and popularize Python and its environment.


The PSF's president is Guido von Rossum himself, and for this reason, these Pythons are called canonical. They are also considered to be reference Pythons, as any other implementation of the language should follow all standards established by the PSF.

Guido van Rossum used the "C" programming language to implement the very first version of his language and this decision is still in force. All Pythons coming from the PSF are written in the "C" language. There are many reasons for this approach and it has many consequences.


One of them (probably the most important) is that thanks to it, Python may be easily ported and migrated to all platforms with the ability to compile and run "C" language programs (virtually all platforms have this feature, which opens up many expansion opportunities for Python).


This is why the PSF implementation is often referred to as CPython. This is the most influential Python among all the Pythons in the world.

Cython

Cython


Another Python family member is Cython.

Cython is one of a possible number of solutions to the most painful of Python's trait - the lack of efficiency. Large and complex mathematical calculations may be easily coded in Python (much easier than in "C" or any other traditional language), but the resulting code's execution may be extremely time-consuming.

How are these two contradictions reconciled? One solution is to write your mathematical ideas using Python, and when you're absolutely sure that your code is correct and produces valid results, you can translate it into "C". Certainly, "C" will run much faster than pure Python.


This is what Cython is intended to do - to automatically translate the Python code (clean and clear, but not too swift) into "C" code (complicated and talkative, but agile).




Jython


Another version of Python is called Jython.

Jython


"J" is for "Java". Imagine a Python written in Java instead of C. This is useful, for example, if you develop large and complex systems written entirely in Java and want to add some Python flexibility to them. The traditional CPython may be difficult to integrate into such an environment, as C and Java live in completely different worlds and don't share many common ideas.


Jython can communicate with existing Java infrastructure more effectively. This is why some projects find it usable and needful.


Note: the current Jython implementation follows Python 2 standards. There is no Jython conforming to Python 3, so far.



PyPy and RPython


Take a look at the logo below. It's a rebus. Can you solve it?

pypy


It's a logo of the PyPy - a Python within a Python. In other words, it represents a Python environment written in Python-like language named RPython (Restricted Python). It is actually a subset of Python.


The source code of PyPy is not run in the interpretation manner, but is instead translated into the C programming language and then executed separately.



This is useful because if you want to test any new feature that may be (but doesn't have to be) introduced into mainstream Python implementation, it's easier to check it with PyPy than with CPython. This is why PyPy is rather a tool for people developing Python than for the rest of the users.


This doesn't make PyPy any less important or less serious than CPython, of course.


In addition, PyPy is compatible with the Python 3 language.


There are many more different Pythons in the world. You'll find them if you look, but this course will focus on CPython.

Join us: Python Pioneers


#PCAT

Report Page