What Would a Faster Python Iteration Mean for Programmers?

What Would a Faster Python Iteration Mean for Programmers?

Sep 6, 2021

Python is already a top-five programming language in terms of number of users around the world. It is also second only to JavaScript as the most sought-after language hiring managers are looking for in their developing teams.

Powerful and flexible, Python is often depicted as the ultimate all-purpose programming language, equally well suited to functional, object-oriented or reflective coding, and popular across data science, AI, web architecture and application development.

But it has one widely acknowledged drawback – compared to other popular languages, it’s slow to run.

It’s an issue that many in the development community are keen to address – and given its importance as a mainstream commercial development tool, these efforts are attracting major enterprise backing.

For example, a new Python iteration launched in May 2021, Pyston, has now been taken up by Anaconda, a well established Python distribution for data science uses. Pyston promises to speed up Python by 30%, and its creators have now been hired directly by Anaconda to continue their work.

Elsewhere, the man responsible for creating Python three decades ago, Guido van Rossum, has come out of retirement to take up a post at Microsoft. Given free rein to pick an open source development project of his choosing, van Rossum has decided to focus on a next gen revamp of his original masterpiece, promising to make Python twice as fast as it is at present.

With Microsoft’s considerable backing, you’d bet on it happening.

So what exactly would a faster Python mean for developers?

Lessening the load

Part of the reason why Python is slow is because it is dynamically typed. This means that, unlike with a statically typed, compiled language, the data types are not pre-defined. This gives Python a lot more flexibility, as you’re not restricted by the type categories already available – you can tell the computer that a data variable is whatever you want it to be. But it also means extra work, first of all for the programmer who has to define all the types themselves, and then for the machine that has to interpret the definitions at the point of execution.

As this article illustrates, for a simple mathematical formula, with Python you are talking about four times as many lines as code compared to a compiled language like C, all because you have to define and create new Python objects (i.e. specify that an integer is an integer, or whatever it mighty be). With a compiled language, you just use the pre-defined object ‘integer’.

Python gets labelled as a programming language best suited to back-end development, data analysis, AI, scientific computing and so on. In other words, it’s good for handling heavyweight, technical stuff where accuracy and performance is more of a concern than speed.

The huge amount of flexibility it offers is certainly a big help in this regard, and a lot of programmers working in these fields actually find the fact that they have to define everything less onerous than having to navigate a path through static frameworks or existing code that wasn’t really designed to do the job.

But in reality, Python is a general purpose language designed to do all jobs. There are plenty of advocates who love using it for building front-end applications. It shouldn’t be forgotten, after all, that JavaScript, the world’s most popular programming language for building web and mobile applications, is also dynamically typed. The flexibility and control it provides over type definition provides huge advantages in things like resource efficiency, testing and debugging, and performance resilience.

These are all benefits available from Python, too. Yet JavaScript is acknowledged as being much more efficient when it comes to run time. Python advocates will argue that there are plenty of ways to make Python faster and more efficient, too, from using data structures and list comprehension properly to multiple assignments and library functions.

But the point is that these are all advanced skills. Expert Python programmers do find it fast and efficient. But it takes quite a learning curve to get to that point.

Ultimately, the main benefit of a faster iteration of Python would be a more utilitarian programming language – one that performs equally well for multiple purposes without having to acquire quite so high a level of expertise. If achieved, that would see Python truly live up its billing as the ultimate programming all-rounder, and perhaps eventually see it challenge even JavaScript as the most widely used language of all.