What is Python
Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming.
Last updated
Was this helpful?
Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming.
Last updated
Was this helpful?
How does it happen that programmers, young and old, experienced and novice, want to use it? How did it happen that large companies adopted Python and implemented their flagship products using it?
There are many reasons - we've listed some of them already, but let's enumerate them again in a more practical manner:
it's easy to learn - the time needed to learn Python is shorter than for many other languages; this means that it's possible to start the actual programming faster;
it's easy to teach - the teaching workload is smaller than that needed by other languages; this means that the teacher can put more emphasis on general (language-independent) programming techniques, not wasting energy on exotic tricks, strange exceptions and incomprehensible rules;
it's easy to use for writing new software - it's often possible to write code faster when using Python;
it's easy to understand - it's also often easier to understand someone else's code faster if it is written in Python;
it's easy to obtain, install and deploy - Python is free, open and multiplatform; not all languages can boast that.
Of course, Python has its drawbacks, too:
it's not a speed demon - Python does not deliver exceptional performance;
in some cases it may be resistant to some simpler testing techniques - this may mean that debugging Python's code can be more difficult than with other languages; fortunately, making mistakes is always harder in Python.
It should also be stated that Python is not the only solution of its kind available on the IT market.
It has lots of followers, but there are many who prefer other languages and don't even consider Python for their projects.
Python has two direct competitors, with comparable properties and predispositions. These are:
Perl - a scripting language originally authored by Larry Wall;
Ruby - a scripting language originally authored by Yukihiro Matsumoto.
The former is more traditional, more conservative than Python, and resembles some of the good old languages derived from the classic C programming language.
In contrast, the latter is more innovative and more full of fresh ideas than Python. Python itself lies somewhere between these two creations.
In addition to Python 2 and Python 3, there is more than one version of each.
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.
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.
Another version of Python is called 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.
Take a look at the logo below. It's a rebus. Can you solve it?
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.
First of all, there are the Pythons which are maintained by the people gathered around the PSF (), 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.
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).