Putting an expiration date on Python would be science-fiction-level speculation. Instead, let’s assess the virtues that are driving Python’s popularity now, and the weaknesses that could break it in the future.
What makes Python popular today
Python’s success is reflected in the stack overflow trends, which measure the tag count on posts on the platform. Given the size of Stack Overflow, this is a good indicator for the language’s popularity.
About 16% of all Stack Overflow questions are tagged “python” – more than Java, C# and C++ added together. Meanwhile, R has stagnated in recent years and many other languages have seen steady decline. There are several reasons for the high interest in Python.
He has good years to live
Python has been around since the 1990s. Not only does this mean it has had plenty of time to grow, it has also gained a large and supportive community.
If you have a problem writing Python code, chances are high that you can solve it with a single Google search – simply because someone has already encountered your problem and written something useful about it.
He is beginner friendly
Python has been around for decades🇧🇷 giving to programmers time to create brilliant tutorials. Furthermore, the syntax of this language is very human readable.
To begin with, there is no need to specify the data type. You just declare a variable, and Python understands from context whether it’s an integer, a float, a boolean, or whatever. This is a huge advantage for beginners. Anyone who works with C++ knows how frustrating it is when your program doesn’t compile because you’ve replaced a float with an integer.
And if you’ve ever had to read Python and C++ code side by side, you should understand how understandable Python is. Although C++ was designed with the English language in mind, this is a trickier read than Python code.
He is versatile
Since Python has been around for a long time, developers have created a package for every purpose. These days, you can find a package for almost anything.
Want to process numbers, vectors and matrices? go from NumPy🇧🇷 Want to do calculations for technology and engineering? Use the SciPy🇧🇷 Want to work with data preparation and analysis? try the pandas🇧🇷 Want to start exploring artificial intelligence? meet the Scikit-Learn🇧🇷
Whatever the computational task, chances are there is a Python package for it. This makes Python relevant to recent developments, which can be seen in the increased interest in machine learning in recent years.
the ddisadvantages of python
Based on what I said earlier, you might think that Python is going to stay at the top for a long time. But like all technology, Python has its weaknesses. Let’s go through the most important failures one by one below.
Development for mobile apps
As we move from the desktop to the smartphone, it’s clear that we need robust languages to create software designed for mobile devices.
However, very few mobile apps are being developed with Python. This is not impossible: there is a Python package called Kivy for this purpose.
But Python wasn’t built with mobile devices in mind. So while it might produce acceptable results for basic tasks, your best bet is to use a language designed for mobile app development. Some widely used programming frameworks for mobile devices include React Native, Flutter, Iconic, and Cordova.
Of course, notebooks and PCs will continue to exist for many years to come. But as mobile devices have long since outpaced desktops, it’s safe to say that learning Python isn’t enough to become a seasoned all-round developer.
A Python script is not first compiled and then executed. Instead, it compiles every time you run it, so any coding errors show up at runtime. This leads to poor performance, is time consuming and requires a lot of testing – Many same.
This is great for beginners as the tests teach a lot. But for experienced developers, it can be a problem to debug a complex Python program.
Python used to be very slow to run, running 2 to 10 times slower than most other languages. He much better in recent years: the Numpy package, for example, is incredibly fast when dealing with lists, matrices, and the like.
Multiprocessing support helped a lot too: it lets you use all of the processor cores in your PC, instead of just one. I’ve been running processes on 20 cores at a time, and hey, it’s already saved me weeks of compute time.
Still, Python remains slower than some alternatives. It is dynamically typed, meaning you don’t need to specify data types like in other languages. This means that the program needs to reserve enough space for each variable it computes, which consumes a lot of memory – and results in a longer processing time.
In Python, you use white spaces and indents to indicate different levels of code. This makes it visually appealing and intuitive to understand.
Other languages, such as C++, rely more heavily on braces and semicolons. While it might not be visually appealing and beginner friendly, it makes the code much easier to maintain. For larger projects it is much more useful.
Newer languages, such as Haskell, solve this problem by adopting the use of whitespace while providing an alternative syntax without whitespace.
In programming, the scope of a variable determines whether or not you can access and modify it in certain parts of the software. It is the context in which that variable can be “seen” and used. For example, if you declare a variable “x” inside a function, it will only be visible inside the body of that function.
Originally, Python had dynamic scope🇧🇷 This basically means that, to evaluate an expression, the compiler first parses the current block of code, then successively passes through all the functions.
The problem with dynamic scoping is that every expression needs to be tested in every possible context — which is tedious. That’s why most modern programming languages use static scope.
Python tried to transition to static scope, which didn’t work out very well🇧🇷 Normally, inner scopes — for example, functions within functions — would be able to see and change external scopes. In Python, inner scopes can only see outer scopes, but cannot change them. This leads to a lot of confusion.
In Python, a lambda function is a special type of function that has no defined name and is contained in just one line of code.
For example, if you want to double a number, you can create a traditional function that does this:
def dobro_de_x(x): return x*2
Or you can do the following:
lambda x: x*2
There is still this option:
dobro_de_x(x) = lambda x: x*2
For all Python’s flexibility, using lambda functions is quite restrictive. They can only be expressions, not statements.
In Python, a statement is a statement that the interpreter can execute – like “if”, “for”, and “while”. On the other hand, an expression is a combination of elements that need to be evaluated – this includes values, variables, operators and function calls.
The distinction between expressions and declarations is quite arbitrary and does not occur in other languages.
What could replace Python in the future
There are some relatively new competitors in the programming language market:
- O rust offers the same kind of security as Python — no variables can be accidentally overwritten. And it delivers more performance with both ownership and loan concepts. It is also the most loved programming language of recent years, according to Stack Overflow Insights🇧🇷
- O go it’s great for beginners, just like Python. And it’s so simple that it makes the code even easier to maintain. Furthermore, Go developers are among the highest paid programmers in the market.
- The Julia is a new language that competes head-to-head with Python. It fills a gap in large-scale technical calculations: normally, one would use Python or Matlab and link everything with C++ libraries, which are needed on a large scale. Now you can use Julia instead of juggling two languages.
While there are many other languages out there, Rust, Go, and Julia are the ones that fix Python’s weaknesses. All of them stand out in technologies that have been gaining strength, especially in the field of artificial intelligence. Their market share is still small, as you can see below in the number of tags on Stack Overflow, but the trend looks promising:
Yes, Python should still be in high demand for a few more years. Given its popularity at the moment, it will certainly take half a decade, maybe even a full decade, for any of these new languages to replace it.