Why Python is not the language of the future

Python is one of the most popular programming languages of recent years. Its clear syntax and readability make it the perfect coding language for beginners. It’s forgivable to think that learning Python was essential given its wide usage.

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

But until when will that trend continue? When will Python eventually be replaced by other languages, and why?

Putting an exact expiry date on Python would be so much speculation, it might as well pass as Science-Fiction. Instead, I will assess the virtues that are boosting Python’s popularity right now, and the weak points that will break it in the future.

What Python Is Good For

In short, Python is becoming the language of machine learning. Most machine language courses are written using the Python language, and coding education as a whole has adopted Python as the language to learn, with wide use in classrooms, on Raspberry Pi, and elsewhere.

These reasons, along with the plethora of big companies using Python, leave many thinking it is the main programming language of the future. But if Python is such a Swiss Army Knife, when wouldn’t you use it?

1. You Want to Be a Web Developer

This is image title

Python is more than capable of large-scale web development. Instagram is the largest site running Django, a Python web framework. This is no mean feat, as Instagram engineer Zekun Li explains:

“We began using Python early on because of its simplicity, but we’ve had to do many hacks over the years to keep it simple as we’ve scaled.”

That said, Django is a robust, elegant framework. The issue does not lie with its failings as such. The simple question is: why learn Django when JavaScript is still so dominant?

JavaScript frameworks like React and Vue.js are in high demand. Both can use Django or other backends like Ruby on Rails. However, since both are JavaScript-based languages, why would you use anything other than Node.js? This makes for a full-stack JavaScript application. One language to learn and master.

2. You Want to Be a Game Developer

This is image title

Users of Pygame might find this section a little confusing. Isn’t there a well-regarded library specifically for creating computer games in Python? Yes, there is, and Pygame is a fantastic resource for learning Python and game mechanics.

Some good games have been written in Python, and there is even a first-person shooter made entirely in Pygame:

Without taking away from the incredible achievement that DUGA is, you can see the issue here. Most (but not all) people wanting to get into game development are looking for something more. A robust platform with development tools and an editor. The potential to scale from a small idea up to something large and more mainstream.

Python cannot offer this, whereas game engines like Unity and Unreal can.

Learn C# for Unity

Unity is based solely on C#, with a considerable number of libraries on top to help with game development. The Unity editor is a very powerful tool allowing for quick prototyping and a fast start for beginners making their first game.

For a comparison of scale and visual beauty, Escape From Tarkov is a Unity Engine creation:

Much like low-level Python tutorials cover programming essentials, Unity’s official tutorials assume no prior programming knowledge.

Learn C++ for Unreal Engine

C++ is somewhat notorious for being difficult to learn. There are resources online for beginners, and the Unreal Engine website has some great getting started tools too.

If you need any evidence that Unreal Engine games can be a success, look no further than Fortnite. This hugely popular game, which you can even play on your mobile, was created and optimized using Unreal.

Games that look like this, and run at 1080p with good frame-rates, are currently not possible using Python. This is not a failing on Python’s part, more a simple case of game development not being one of its strengths.

3. You Want to Work With Low-Level Systems

While the amateur robotics community loves Python, it isn’t the best language for the job. In many low levels and embedded systems, Python isn’t an option.

Embedded Systems

While the definition of what an embedded system is has become blurred in recent years, there is a good analogy. It’s safe to consider small development boards such as Arduino as embedded. Larger, more complex devices like Raspberry Pis or similar single-board computers are generally not seen as embedded.

The issue lies where memory and timing are essential. An 8-bit chip in a piece of embedded hardware needs to have its memory managed very carefully. This is not something Python is suited for, and there is a reason why the Arduino language is a simplified version of C/C++. Getting a grasp of Arduino’s version of C++ is less complex than you would think.

The C programming language is as powerful as it can be dangerous. Despite being high-level, C and its C++ super-set can access low-level processes. Essentially, C was the first translation of machine code into something that humans could easily understand.

Precision and Speed

On top of the ability to manage systems at a low level, C comes with a speed increase. Since C is a very raw language, there are no overheads or garbage collection to slow it down. This is where C gets its reputation for being dangerous, as memory leaks can cause terrible problems. It does mean, however, that C shines where timing and speed are critical.

Anyone looking to get into hardware programming or any form of kernel programming should consider looking into C. The same is true for anyone wishing to create device drivers.

Bonus fact: Have you used VSTs to create digital music and wondered how to make them? You can write your own using C++.

4. Do You Need Python?

While this may sound obvious-if you already know another capable coding language, why change?

If you took a coding class in school, or started an online coding course in a particular language, sticking to it has benefits. Learning your first language gives you the fundamentals of programming, and switching to learn a whole new syntax slows that process down.

Most top-level Python coders didn’t begin working with the language. Due to its highly readable nature and intuitive syntax, many find it easier to learn Python coming from other languages.

What makes Python popular right now

Python’s success is reflected in the Stack Overflow trends, which measure the count of tags in posts on the platform. Given the size of StackOverflow, this is quite a good indicator for language popularity.

Python

While R has been plateauing over the last few years, and many other languages are on a steady decline, Python’s growth seems unstoppable. Almost 14% of all StackOverflow questions are tagged “python”, and the trend is going up. And there are several reasons for that.

It’s old

Python has been around since the nineties. That doesn’t only mean that it has had plenty of time to grow. It has also acquired a large and supportive community.

So if you have any issue while you’re coding in Python, the odds are high that you’ll be able to solve it with a single Google search. Simply because somebody will have already encountered your problem and written something helpful about it.

It’s beginner-friendly

It’s not only the fact that it has been around for decades, giving programmers the time to make brilliant tutorials. More than that, the syntax of Python is very human-readable.

For a start, there’s no need to specify the data type. You just declare a variable; Python will understand from the context whether it’s an integer, a float value, a boolean or something else. This is a huge edge for beginners. If you’ve ever had to program in C++, you know how frustrating it is your program won’t compile because you swapped a float for an integer.

And if you’ve ever had to read Python and C++ code side-by-side, you’ll know how understandable Python is. Even though C++ was designed with English in mind, it’s a rather bumpy read compared to Python code.

It’s versatile

Since Python has been around for so long, developers have made a package for every purpose. These days, you can find a package for almost everything.

Want to crunch numbers, vectors and matrices? NumPy is your guy.
Want to do calculations for tech and engineering? Use SciPy.
Want to go big in data manipulation and analysis? Give Pandas a go.
Want to start out with Artificial Intelligence? Why not use Scikit-Learn.

Whichever computational task you’re trying to manage, chances are that there is a Python package for it out there. This makes Python stay on top of recent developments, can be seen from the surge in Machine Learning over the past few years.

Downsides of Python — and whether they’ll be fatal

Based on the previous elaborations, you could imagine that Python will stay on top of sh*t for ages to come. But like every technology, Python has its weaknesses. I will go through the most important flaws, one by one, and assess whether these are fatal or not.

Speed

Python is slow. Like, really slow. On average, you’ll need about 2–10 times longer to complete a task with Python than with any other language.

There are various reasons for that. One of them is that it’s dynamically typed — remember that you don’t need to specify data types like in other languages. This means that a lot of memory needs to be used, because the program needs to reserve enough space for each variable that it works in any case. And lots of memory usage translates to lots of computing time.

Another reason is that Python can only execute one task at a time. This is a consequence of flexible datatypes — Python needs to make sure each variable has only one datatype, and parallel processes could mess that up.

In comparison, your average web browser can run a dozen different threads at once. And there are some other theories around, too.

But at the end of the day, none of the speed issues matter. Computers and servers have gotten so cheap that we’re talking about fractions of seconds. And the end user doesn’t really care whether their app loads in 0.001 or 0.01 seconds.

Scope

Originally, Python was dynamically scoped. This basically means that, to evaluate an expression, a compiler first searches the current block and then successively all the calling 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 scoping.

Python tried to transition to static scoping, but messed it up. Usually, inner scopes — for example functions within functions — would be able to see and change outer scopes. In Python, inner scopes can only see outer scopes, but not change them. This leads to a lot of confusion.

Lambdas

Despite all of the flexibility within Python, the usage of Lambdas is rather restrictive. Lambdas can only be expressions in Python, and not be statements.

On the other hand, variable declarations and statements are always statements. This means that Lambdas cannot be used for them.

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

Python

Whitespaces

In Python, you use whitespaces and indentations to indicate different levels of code. This makes it optically appealing and intuitive to understand.

Other languages, for example C++, rely more on braces and semicolons. While this might not be visually appealing and beginner-friendly, it makes the code a lot more maintainable. For bigger projects, this is a lot more useful.

Newer languages like Haskell solve this problem: They rely on whitespaces, but offer an alternative syntax for those who wish to go without.

Mobile Development

As we’re witnessing the shift from desktop to smartphone, it’s clear that we need robust languages to build mobile software.

But not many mobile apps are being developed with Python. That doesn’t mean that it can’t be done — there is a Python package called Kivy for this purpose.

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

To be clear, laptops and desktop computers should be around for many years to come. But since mobile has long surpassed desktop traffic, it’s safe to say that learning Python is not enough to become a seasoned all-round developer.

Runtime Errors

A Python script isn’t compiled first and then executed. Instead, it compiles every time you execute it, so any coding error manifests itself at runtime. This leads to poor performance, time consumption, and the need for a lot of tests. Like, a lot of tests.

This is great for beginners since testing teaches them a lot. But for seasoned developers, having to debug a complex program in Python makes them go awry. This lack of performance is the biggest factor that sets a timestamp on Python.

What could replace Python in the future — and when

There are a few new competitors on the market of programming languages:

  • Rust offers the same kind of safety that Python has — no variable can accidentally be overwritten. But it solves the performance issue with the concept of ownership and borrowing. It is also the most-loved programming language of the last few years, according to StackOverflow Insights.
  • Go is great for beginners like Python. And it is so simple that it’s even easier to maintain the code. Fun point: Go developers are among the highest-paid programmers on the market.
  • Julia is a very new language that competes head-on with Python. It fills the gap of large-scale technical computations: Usually, one would have used Python or Matlab, and patched the whole thing up with C++ libraries, which are necessary at a large scale. Now, one can use Julia instead of juggling with two languages.

While there are other languages on the market, Rust, Go, and Julia are the ones that fix weak patches of Python. All of these languages excel in yet-to-come technologies, most notably in Artificial Intelligence. While their market share is still small, as reflected in the number of StackOverflow tags, the trend for all of them is clear: upwards.

Python

Given the ubiquitous popularity of Python at the moment, it will surely take half a decade, maybe even a whole, for any of these new languages to replace it.

Which of the languages it will be — Rust, Go, Julia, or a new language of the future — is hard to say at this point. But given the performance issues that are fundamental in the architecture of Python, one will inevitably take its spot.

#python #web-development #machine-learning

Why Python is not the language of the future
117.40 GEEK