According to the latest TIOBE index (the leading indicator of programming language popularity) a change in the leaderboard of programming languages in the world has taken place. The long ruling emperors, Java and C, both had to acknowledge Python as the new king of the rankings.
Python – the long story short
Python was initially released in 1991 by Guido van Rossum, who shouldered the full responsibility for the project up to July 2018, when he decided to step down from the leading Python developer position. Throughout that time, the Python world has enjoyed 2 major releases and a whole host of enhancements. Following the decision of the father of Python to step down from the board, a Steering Committee was elected from the core developers. As in every democratic world, the people are able to influence the direction of further Python development. This is done via Python Enhancement Proposal (PEP), the use of which enables proposals for new features to the Python core library. Such as a proposal is then reviewed by the Steering Committee and accepted or declined. In the moment of writing, the latest available Python version is 3.10.
When any somewhat experienced developer begins to learn a new language, the first set of questions that pop out are about the specifications. A quick description of Python features will satisfy such questions before they are asked:
- Python is a high-level language – it handles pointers and memory management, so that the code written is closer to how humans think;
- Python is dynamically typed – unlike statically-typed languages, for example Java, in Python you do not have to define whether a value is a string, boolean or number, some other kind of object, Python does that for you internally;
The purpose of this short introduction to Python features is then to shed more light on that particular issue. In the world of IT, everything is a matter of compromise and everything comes at a price. As pointed out Python does a lot under the hood for the developer, in hiding the complex and mundane aspects of programming. The end result is of course brevity both in terms of code readability and delivery of business value, but comes with the price of Python being much slower than C or C++. That poses the question of how Python has become so popular despite the innate slowness?
Python – main reasons for being the number one
The slowness may have been one of the reasons why Python was not so widely adopted earlier on. After all, it was brought to life 30 years ago, in a period when hardware was expensive and had a limited capacity. Over recent years both have been becoming substantially more powerful and cheaper. With the dawn of the cloud era, when one can bring to life a powerful virtual machine instance just to execute a resource savvy script, to drop it and just pay for the time the instance was alive, nobody pays that much attention to resource management. Delivering business value and delivering it fast is the key aspect of today’s world.This is where Python shines bright and stands out from the crowd.
Easy to learn – human-readable syntax
One could still argue that code written in Python would execute slower on the same machine than a similar program written in native C. I dare to say, so what? Would the end user really see the difference of milliseconds? This is of course not to say that performance and using the maximum potential of the underlying infrastructure is not important. It is of the highest importance, but one needs to look at the whole spectrum of performance. Writing a verbose and optimized code in C is time-consuming, while delivering the same functionality with the use of robust and concise Python code takes a lot less time. In today’s world, rapid delivery corresponds directly to market advantage. Moreover, from my experience, I can say that less code results in two very important things:
a) more profound “code reviews” – does the story of a developer doing a code review of 30 lines of code and noting 10 issues, and the same developer doing a code review of 300 lines of code and spotting only one, ring a bell?
b) easier maintenance – we as developers spend more time reading and analyzing the code, than actually writing it;
Python offers a very friendly human-readable syntax. It is very similar to computer instructions written in English. The loved and hated “indentation rule” introduced in PEP8, which determines the beginning and the end of a code block, gives the impression of reading prose rather than code, when going through lines of Python. This is why so many developers starting their careers decide to go with it. The basic syntax is easy to grasp and at the same time very powerful. For the very same reason it is often chosen by people not directly related with programming, such as academics or scientists from different fields.
Versatile and powerful
Python comes with “batteries included”, which means that the basic pack of libraries is very ubiquitous and offers methods which relieve the developer from writing a lot of boilerplate code. The ease and speed of coding entices its use for prototyping, where we want to quickly check if the rubber meets the road. On top of that, it is a mature language with strong support from a wide community, which results in a plethora of useful libraries in different fields, saving us the developers plenty of time. It is a versatile general-purpose language that is being widely adopted in such areas as:
- automation and scripting – a perfect tool becoming increasingly in-demand in the DevOps field;
- web development – with the use of frameworks such as Django;
- Big Data analysis – prior to conducting any big data analysis, one needs to clean and organise it into useful data sets by transforming it. This cumbersome task is a breeze with the use of Python libraries, such as Pandas or NumPy.
- Machine Learning and Artificial Intelligence – those are the hot buzz words nowadays and the demand for developers experienced in those areas has sky-rocketed in the last couple of years. Python with the use of Tensorflow, Keras and Pytorch stands out from the crowd, allowing scientists to focus on their day to day tasks, instead of focusing on technology aspects.
The success of Python lies in its versatility and especially good fit in the data manipulation and analysis areas, which is in high demand right now. Nowadays, companies build their competitive advantage based on conclusions and predictions extracted from the data. Python helps in doing this quickly and reliably.
Prospects for the future