Seven claws source code: why Python is not the programming language of the future

thumbnail

It took decades for the programming community to appreciate Python. But since the early 2010s, it's been booming—and eventually surpassing C, C#, Java, and JavaScript in popularity.

But how long will this trend continue? When will Python finally be replaced by other languages ​​and why?

Setting an exact expiration date on Python will be a lot of guesswork, and it will probably pass like science fiction. Instead, I'll assess the strengths that currently boost Python's popularity, and the weaknesses that will undermine it in the future.

Python's success is reflected in Stack Overflow trends, which measure the number of hashtags in posts on the platform. Given the size of StackOverflow, this is a good indicator of a language's popularity.

While R has plateaued over the past few years, and many other languages ​​have been in steady decline, Python's growth seems unstoppable. Almost 14% of StackOverflow questions are tagged with "python", and the trend is rising. There are several reasons for this.

it's old

Python has been around since the nineties. That doesn't just mean it's had plenty of time to grow. It also has a huge supportive community.

So if you have any problems coding in Python, chances are you can solve it with a single Google search. Just because someone has already encountered your problem and written something useful.

its beginner friendly

Not only is it the fact that it's been around for decades, it gives programmers time to make great tutorials. Not only that, Python's syntax is very easy to read.

First, there is no need to specify the data type. You just declare a variable; Python will understand from the context whether it's an integer, float, boolean, or something else. This is a huge advantage for beginners. If you've ever programmed in C++, you know how frustrating it can be if your program doesn't compile because you swapped floats for integers.

If you've ever had to read Python and C++ code side by side, you know how accessible Python is. Even though C++ was designed with English in mind, it can still be rather bumpy to read compared to Python code.

it is versatile

Since Python has been around for a long time, developers have made a package for various purposes. These days, you can find packages for just about anything.

Want to work with numbers, vectors and matrices? NumPy is your man.

Want to do computing for technology and engineering? Use SciPy.

Want to become bigger and stronger in data processing and analysis? Give pandas a chance.

Want to start with artificial intelligence? Why not use Scikit-Learn.

No matter which computing task you're trying to manage, chances are there's a Python package for it. This keeps Python at the forefront of the latest developments, as seen in the machine learning boom of the past few years.

Python's Weaknesses - and Whether They Can Kill You

Based on the foregoing, you can imagine that Python will maintain its leading position in the years to come. But like every technology, Python has its weaknesses. I'll go through the most important flaws one by one and assess whether they are fatal or not.

speed

Python is slow. Like, really slow. On average, it takes 2 to 10 times longer to complete a task in Python than in any other language.

There are various reasons for this. One of them is that it's dynamically typed - remember you don't need to specify data types like in other languages. This means that a lot of memory is used, as the program needs to reserve enough space for each variable to work under any circumstances. A large amount of memory usage translates into a large amount of computing time.

Another reason is that Python can only execute one task at a time. This is a consequence of flexible data types - Python needs to ensure that each variable has only one data type, and parallel processes can screw things up.

By comparison, your average web browser can have a dozen different threads running at the same time. There are some other theories.

But at the end of the day, none of the speed issues matter. Computers and servers have gotten so cheap that we're talking fractions of a second. End users don't really care whether their application loads in 0.001 seconds or 0.01 seconds.

scope

Originally, Python was dynamically scoped. This basically means that, to evaluate an expression, the compiler first searches the current block and then all calling functions in turn.

The problem with dynamic scoping is that every expression needs to be tested in every possible context - which is tedious. This is why most modern programming languages ​​use static scope.

Python tried to transition to static scope, but screwed it up. Typically, an inner scope - such as a function within a function - will be able to see and change the outer scope. In Python, inner scopes can only see outer scopes, but cannot change them. This can cause a lot of confusion.

Lambda

For all the flexibility of Python, the use of Lambdas is rather limited. Lambdas can only be expressions in Python, not statements.

On the other hand, variable declarations and statements are always statements. This means Lambda cannot be used with them.

This distinction between expressions and statements is rather arbitrary, and doesn't arise in other languages.

space

In Python, you use spaces and indentation to indicate different levels of code. This makes it visually appealing and intuitive to understand.

Other languages, such as C++, rely more on braces and semicolons. While this might be visually unappealing and beginner-friendly, it makes the code more maintainable. This is more useful for larger projects.

Newer languages ​​like Haskell solve this problem: they rely on whitespace, but offer an alternative syntax for those who wish to do without it.

mobile development

As we witness the transition from desktops to smartphones, it's clear that we need powerful languages ​​to build mobile software.

But not many mobile applications are developed using Python. That doesn't mean it can't be done - there's a Python package for this called Kivy.

But Python wasn't designed with mobile devices in mind. So even though it might produce acceptable results for basic tasks, your best bet is to use a language created for mobile app development. Some widely used mobile programming frameworks include React Native, Flutter, Iconic, and Cordova.

To be clear, laptops and desktops should be around for many years to come. But since mobile traffic has already surpassed desktop traffic, it's safe to say that learning Python isn't enough to become an experienced all-around developer.

runtime error

Python scripts are not compiled and then executed. Instead, it compiles every time you execute it, so any coding errors will manifest themselves at runtime. This results in poor performance, time consumption, and extensive testing. For example, many tests.

This is great for beginners as the test teaches them a lot. But for experienced developers, having to debug a complex program in Python can make them go wrong. This lack of performance is the biggest factor in setting timestamps on Python.

What could replace Python in the future - and when

There are some new competitors in the programming language market:

  • Rust offers the same safety as Python - no variables will be accidentally overwritten. But it solves the performance problem through the concepts of ownership and borrowing. It's also the most popular programming language for the past few years, according to StackOverflow Insights.
  • Go is great for beginners like Python. And it's so simple that maintaining the code is easier. Interesting point: Go developers are some of the highest paid programmers on the market.
  • Julia is a very new language that competes head-on with Python. It fills a gap in technical computing at scale: normally, one would take Python or Matlab, and patch the whole thing with a C++ library, which is required at scale. Now, one can use Julia instead of two languages ​​at the same time.

While there are other languages ​​on the market, Rust, Go, and Julia are the languages ​​that fix Python's weak patches. All of these languages ​​excel in technologies that have yet to emerge, especially in artificial intelligence. While their market share is still small, as reflected in the number of StackOverflow tags, their trend is clear: upwards.

Given the ubiquitous popularity of Python right now, it will certainly be five years, possibly five years, before any of these new languages ​​replace it.

Follow Qipao.com to get more APP/small program/website source code resources!

Latest Programming News and Information | GeekBar

Related Posts