Why the future is not for Python

Although, of course, this programming language will be in demand for many more years.



It took the programming community decades to appreciate Python. Since the beginning of the 2010s, it has been booming - and ultimately surpasses C ++, C #, Java and JavaScript in popularity.

But how long will this trend continue? When will Python eventually be replaced by other languages, and why will this inevitably happen?
EDISON Software - web-development
The translation was supported by EDISON.

We are developing applications in Python , as well as doing software testing .

We love and use Python extensively! ;-)

What makes Python popular today


The popularity of Python can be judged by StackOverflow, if you look at the number of tags in the posts. Given the scale of StackOverflow, this is a pretty objective indicator of the popularity of the language.


Mention on StackOverflow of some popular programming languages ​​- the dynamics of changes over the years. Python's performance is growing steadily, while competitors are declining.

While R has been on the plateau over the past few years, and many other languages ​​are steadily declining, Python's growth seems unstoppable. Nearly 14% of all StackOverflow questions are labeled “python,” and this trend is only growing. And there are a number of reasons for this.

Time tested


Python has existed since the nineties. It's not just that he had plenty of time for growth. And also that a large and supportive community has formed.

Therefore, if you encounter any problems while writing Python code, there is a high probability that you can quickly solve them using Google Search. Just because someone has already encountered a similar problem and wrote something useful about this.

Friendly to beginners


And the point is not only that the language has existed for several decades, for which programmers have written a number of brilliant textbooks. The Python syntax is also very readable.

First, there is no need to specify a data type. You simply declare a variable - from the context, Python will understand whether it is an integer, a floating-point value, a boolean, or something else. This is a great help for beginners. If you have ever had to program in C ++, then you know how sad it is when a program does not compile because an integer is substituted instead of a floating-point number.

And if you've ever had to compare Python and C ++ code, then you know how much more understandable Python looks. Despite the fact that C ++ is designed taking into account the English language, this is a very difficult reading compared to the Python code.

Universal


Python has been around for a long time, during which developers have created many libraries for all occasions. Nowadays, for almost everything you can find the required tool.

A lot of numbers, vectors and matrices? NumPy to the rescue.
Technical engineering calculations? Use SciPy .
Big data analysis? Pandas will figure it out.
Machine learning, neural networks, AI? Why not Scikit-Learn ?

No matter what computational task you run into, there is a chance that there is a Python package for it. This allows the language to stay in trend, which is noticeable by the growing popularity of machine learning over the past few years.

Python flaws - and can they bury the language


Inspired by the current state of affairs, one can imagine that Python is a serious and long term. But, like any technology, Python has its weaknesses. Let us examine in order the most important shortcomings, and evaluate whether they are fatal or not.

Speed


Python is slow. No, well, really slow. On average, a task runs 2-10 times longer than in competing languages.

There are reasons for this. First, dynamic typing - remember, we said above that it is very convenient when you do not need to specify data types, as in other languages? The flip side of the coin is the need to use a large amount of memory, because the program needs to reserve enough space for each variable so that it works anyway. And the memory “with a margin” leads to a greater expenditure of computational time.

Secondly, Python can only perform one task at a time. This is also a consequence of flexible data types - Python must make sure that only one data type corresponds to each variable, and parallel processes can interfere with this.

But, by and large, speed is not critical. Productive computers and servers are so accessible that we can only talk about fractions of a second. The end user doesn’t care if his application loads in 0.001 or in 0.01 seconds.

Area of ​​visibility


Python was initially dynamically limited. This basically means that to evaluate the expression, the compiler first searches for the current block, and then sequentially all the calling functions.

The problem with dynamic scope is that every expression needs to be checked in all possible contexts, which is tedious. This is why most modern programming languages ​​use static scope.

Python tried to move to static scope, but failed. Typically, internal scopes, such as functions within functions, can see and change external scopes. In Python, inner regions can only see outer regions, but not change them. This leads to a lot of confusion.

Lambda functions


Despite all the flexibility of Python, the use of lambda is quite limited. They can only be expressions in Python, but not operators.

Variable declarations and operators, on the other hand, are always operators. This means that lambdas cannot be used for them.

This distinction between expressions and statements is rather arbitrary and does not occur in other languages.


Strict indentation makes the code more readable, but their inevitability impairs support.

Spaces and Tabs


In Python, spaces and tabs are used to indicate different levels of code. This makes it visually appealing and intuitive.

In other languages, such as C ++, curly brackets with semicolons are used for nested structures. Although this may not be so beautiful and inconvenient for beginners, it makes the code more convenient to maintain. With the growth of the project, the importance of this approach also increases.

New (relatively) languages ​​like Haskell solve this problem: they rely on spaces, but offer alternative syntax for those who want to do without them.

Mobile development


As there is a massive shift from desktop PCs to smartphones, it is obvious that there is an increasing need for reliable languages ​​for creating mobile software.

But mobile applications in Python about two times and miscalculated. This does not mean that this is not possible at all - for this there is a package called Kivy.

Python was not created for mobile devices. Even if it can give acceptable results for solving basic problems in this area, it is best to use a language tailored for the development of mobile applications. Some commonly used programming platforms for mobile devices include React Native, Flutter, Iconic, and Cordova.

Of course, laptops and desktop PCs will still be used for many years. However, mobile devices have long surpassed desktop traffic. It's safe to say that learning Python is not enough to be considered an experienced, comprehensive developer.

Runtime errors


First, compilation separately, then execution - in some other languages, but not in Python. Instead, the code compiles whenever it is executed, so any error in the code appears during program execution. This leads to reduced performance, unnecessary time consumption and the need for a large number of tests. More tests to the god of tests!

This is great for beginners, as testing alone teaches a lot. But for experienced developers, having to debug a complex program in Python makes them wrong. This lack of performance is the most serious factor indicating that Python will pass in the foreseeable future.

What could replace Python in the future - and when


Several new competitors appeared on the market of programming languages:

  • Rust , Python — . . StackOverflow Insights, .
  • Go , Python. , . : Go — .
  • Julia is a very new language that directly competes with Python. It fills the gap in large-scale technical calculations: usually you could use Python or Matlab, performing part of the tasks (sometimes a very significant part) using C ++ libraries. Now, instead of juggling with two languages, you can simply use Julia.

Although there are other languages ​​on the market, Rust, Go, and Julia fix Python weaknesses. All of these languages ​​are excellent in future technologies, especially in artificial intelligence. Although their market share is still small (which is reflected in the number of StackOverflow tags), the trend for each of them is obvious: up and only up.


Mention on StackOverflow for Go / Rust / Julia - dynamics of changes over the years. The indicators are still modest, but these languages ​​have a steady uptrend.

Given the widespread popularity of Python today, it will take half a decade, maybe even a whole, for any of these new languages ​​to replace it.

It is difficult to say which language it will be - Rust, Go, Julia or some other new language of the future. But given the performance issues that are fundamental to Python because of its architecture, the inevitable will happen sooner or later.

All Articles