Recently I've been reflecting on the (loosely defined) quality and popularity of programing languages. Despite growing appreciation for static typing and compilers (whether in fully-compiled languages like Java or with JIT recently introduced in PHP or Ruby), 2 dynamic, scripting languages pushed their way up in the popularity rankings in the last couple of years. These languages are JavaScript and Python.

While JavaScript has had a huge advantages of having its interpreter installed on most of computers and of being the only language that could be directly executed in the browser, Python's success on the surface seems more unexpected and less obvious. In this post I'm going to think and try to find out why Python has won against other, similar languages.

If you can think some other reasons you'd like to share, drop me a message or leave a comment in the discussions linked below. And if you enjoy my content, make sure to check out my YouTube channel where I share career-related advice for programmers.

Chart showing popularity of programming languages over time according to TIOBE index; Python popularity remains rather steady from 2005 to 2018 and then suddenly grows
TIOBE creates one of the most popular (hard to evaluate quality) rankings of programming languages popularity

Competitors

In a relatively short period of time, between 1987 and 1995, a few major and influential languages were created. Among them there were a couple of high-level scripting languages that gained a lot of popularity and that remain used and are developed until today:

  • Python was created by Guido van Rossum, a Dutch programmer working at a research institute. Inspired by ABC, created at the institution where van Rossum worked at that time, Python was initially created in late 1980s. Driven by values like explicitness, simplicity and readability, 30 years later Python is among the most popular languages in the world and is heavily used in many areas like machine learning, academia or web development
  • PHP wasn't really meant to be a language, but rather a preprocessor which was supposed to help generating HTML more dynamically. Created in 1994 in Canada, PHP quickly gained popularity as a new, easy way to create websites that can connect to database and dynamically generate content before sending it to the user. It's been 20 years since arguably the most influential version of PHP was released (4.0). Today PHP team aims to release version 8 soon, and the language they develop, despite a lot of competition, continues to power a significant portion of websites and web applications all around the world.
  • Perl might not be so well known by younger readers due to a complicated history over the last 15 years, but once it was a language of hackers and programming enthusiasts. Its development started in 1987, the last major version, Perl 5,  was released in 2000, but a new one, Perl 7 (the history of Perl 6 is complicated) is just around the corner. Perl does not have a single purpose like PHP. While it has been used extensively as a backend server language, it's also used for some system tools in utilities in GNU/Linux.
  • Ruby is a creation of Japanese programmer, Yukihiro Matsumoto, who wanted to create a language that would be pleasant to work with. Programmer's happiness, freedom and flexibility are values that drove the development of the language. The project waas started in 1993, and in December 2020, a new major version, Ruby 3, is expected. While Ruby gained worldwide popularity thanks to a web framework, Ruby on Rails, and is often considered a web programming language, it has significant usage in other domains like server tooling and, primarily in Japan, embedded devices
  • JavaScript is kind of a guest in this article, as I can't say that it's clearly less popular than Python, so I will mention it here and there. Created in 1995 in USA it started as a language to be included in Netscape Navigator browser. Its goal was to add more dynamic elements to websites. It later became de facto standard for other browsers, and in early 2010s, with creation of NodeJS, it moved out of the browser to become a general purpose language. While it remains primarily used for the web, we see an increase in number of desktop applications and various utilities created in JavaScript (or one of languages compiling to JS like TypeScript).
Collage of multiple photos. From the left: Rasmus Lerdorf (creator of PHP), Brendan Eich (creator of JavaScript), Guido van Rossum (creator of Python), Larry Wall (creator of Perl) and Yukihiro Matsumoto (creator of Ruby)
From the left: Rasmus Lerdorf (creator of PHP), Brendan Eich (creator of JavaScript), Guido van Rossum (creator of Python), Larry Wall (creator of Perl) and Yukihiro Matsumoto (creator of Ruby)

What made Python #1

Features?

When I think about the languages above, I can't clearly choose the best one in terms of capabilities. While Ruby has been my go to language for many years, I understand why others might prefer basically any other language from the list and they can make very valid arguments to justify their choice.

Over time all these languages became more and more similar to each other. Don't get me wrong, there are still major differences between them - different philosophies, syntaxes, different legacy issues - in the recent years they all became much closer to each other in terms of features though. So while I am sure that certain features can drive the initial interest and usage of the language (PHP made it simple to generate dynamic websites, Perl's syntax was created with linguistic principles in mind), I don't think that Python won because of having tuples, shorter syntax or enforced indentation. There must be more than that.

Corporate adoption

A strong corporate player which adopts some language in its own software and openly declares it can be a huge boost for the language popularity. Even more if the language is created by the company. The success of Java as an enterprise language is owed at least in part to marketing efforts of Sun. C# would never reach its current position if it wasn't created and promoted by Microsoft.

While Python was created as a hobby project and not a business tool, it got some strong support in 2000s, with Google as the biggest company adopting Python. Neither of the other languages has ever received such a strong support. Even though Facebook was initially written in PHP, today it's hard to see any PHP code among their open source projects (beside Hack, their language built from PHP).

Corporate support does not guarantee success - Dart created by Google is still actively developed, but never reached popularity of Python or even Go (another Google's language). Therefore it can't be the solely reason explaining Python's popularity over other languages, but it gave Python a big boost in 2010s and the age of data science.

logo Google, +, logo of Python, +, academic hat
Google and other corporations that adopted Python together with academia boosted language adoption

Academia and first mover advantage

I'm pretty sure you know the history of QWERTY - the keyboard layout used by nearly 100% of people using Latin alphabet (with some minor modifications in various countries). QWERTY was not designed for fast typing - quite the opposite, its goal was to prevent people from typing too fast, because that blocked the typing machines, which were very common before invention of modern computers. The old limitations do not apply anymore, yet we still use the same suboptimal layout. Why? Because everyone else uses is. Because almost every keyboard in the world is designed with this layout in mind, and making people switch would require enormous effort.

It's quite hard to change habit as an individual, and even harder as a large group of individuals with their own opinions. I believe this is one of the reasons behind lasting popularity of some programing languages. Let's take PHP - since early 2000s it's been supported by basically any hosting provider. If you wanted to run applications in Python you had to buy VPS and install the interpreter on your own, or ask the admin to provide it for you. And PHP was already there, so why not to use it instead?

This might be a bit of a stretch, but I think a similar thing can be said about Python in academia. Yes, technically it wasn't the first language used by academic institutions, but I believe it was the first language that allowed scientists to write high-level code and provided them with large set of functions that allowed scientists to work with complex numbers and equations. While significantly slower than PHP, Python allowed everyone to quickly build prototypes which later could be moved to C or C++ if performance was the problem.

With the rise of open source and growing number of available libraries, Python became go-to scripting language in academia and while there are other tools that might be more popular (looking at MATLAB for calculations and Java as intro to programming for students), Python's position is very strong, and any language that will try to take its position has to compete against 20+ years of work on libraries and tools written for scientists.

The rise of the new

Together with the two reasons above comes timing and the changes happening in software industry. In the last few years the large web frameworks started losing steam. Growing popularity of microservices and function-as-a-service, together with some benefits of using the same language for the client and the API, pushed adoption of JavaScript as the language of the web (there were more reasons for sure). Other languages which were primarily used in the webdev had to either find other niches or accept losing popularity.

At the same time another area started gaining huge popularity - data science. Such a powerful, new discipline had a chance to open door for new players - in terms of business, technological advancement, and (among many others) programming tools. It also helped Python to establish and strengthen its position as the programming language on the verge of science and engineering.

Collage of logos. Python's popular libraries, from top left: Ansible, NumPy, Tensorflow, pandas, django, Python itself, Flask, PyTorch, SciPy
Python's popular libraries, from top left: Ansible, NumPy, Tensorflow, pandas, django, Python itself, Flask, PyTorch, SciPy

1+2+3 = Python the King

Let's add these 3 points together. It's some time between 2010-2015. Python together with R and MATLAB are the programming environments used by scientists. At the same time big tech companies know that machine learning is going to grow quickly and they build tools to enable scientists and engineers to use the potential of modern computational power combined with neural networks. Google works on TensorFlow, which will become the most popular machine learning framework. What do they use? The language of the science, the language they've adopted a few years before - Python. Of course the implementation of TensorFlow is done in CUDA and C++ due to performance, but the programming interface for its users is provided in Python.

The rest seems rather straightforward from then on: Facebook's PyTorch, a competing tool, also leverages Python. Data Science bootcamps - which appeared so suddenly and in such a number like mosquitos at the lake in a hot, sunny summer evening - teach Python. Your neighbor creating Udemy courses for beginners also teaches Python.

Since Python has existed for more than 20 years and has been used in various industries and applications, its growth thanks to data science pushed forward adoption in other areas - Django and Flask get users who came to Python for data science, but stayed for good.

Why not other languages?

Python's story seems so easy and obvious in hindsight, but there were a lot of obstacles on the way. The infamous migration from version 2 to version 3 could have been (and I guess for many people was) a disaster. Till today creators of programming languages say "we don't want to repeat Python's scenario" when explaining their decisions regarding breaking backwards compatibility. Python's packaging tools (famous "- how to install pip? first install easy_install", moving from eggs to wheels as packaging format) were behind those available in other languages. Eventually it didn't matter though, despite all these issues, Python not only maintained its position, but even gained a lot of popularity over the years.

Finally let's have a look at the other scripting languages that I have mentioned in the beginning and think and wonder about why it wasn't them that reached such popularity in recent years:

PHP

PHP actually might have reached similar level of popularity around 2002-2008, and it is still going strong when it comes to web development. However it's never been a general purpose language. While it is possible to write a PHP script that will act as a Unix system tool, the language at its core is meant to be used for server side of web applications.

On top of that, I believe PHP has certain characteristics that make it more difficult to use by larger teams (not saying it's impossible, just more difficult) - weak typing, lack of arrays (its number-indexed arrays are actually dictionaries), inconsistency in many places like function names or order of parameters - I guess one of the reasons why Facebook created Hack was to get rid of a lot of legacy stuff in PHP.

JavaScript

As I wrote in the introduction, I believe JS might be equally or more popular than Python, but despite its quickly growing popularity in early-to-mid 2010s it is not clearly the number 1 dynamic language. Why hasn't it dominated the entire space occupied by dynamic languages after it dominated the web? I'd say the first reason is that until a few years ago JS wasn't even a good programming language. I spent a couple of years using CoffeeScript instead, simply because it was so much more pleasant to write. It changed with the ES6 and new features introduced to the language, but that was quite late. JS now and JS in 2012 are 2 very different worlds, and years ago when NodeJS was introduced there was a strong resistance to it. A lot of programmers didn't want JS to spread to the backend where there were many other options to choose from. On top of that, JavaScript for years was considered rather a toy, a language to add animation on the website, not something to use for large projects, so it took time to convince people (and especially backend programers) that it's stable, mature and good enough for more advanced tasks.

Perl

I've never done any serious work in Perl, so I don't really know why it failed to keep growing in popularity. Based on my understanding of the language and its development (as well a few hours spent on reading about this topic), Perl in its current form as of Perl 5 reached its limits in terms of attractiveness to programmers. It was great for scripting, but it was too hard to maintain large codebases in it. And the development of Perl 6, a version that was supposed to fix these problems and make language clearer, took 16 years to be released and eventually in 2019 the language was renamed to Raku (and is not considered a successor of Perl 5). By then a large number of developers have already moved to other languages like Python or Ruby. Interestingly, Python also had a rocky migration, but it was eventually successful, unlike moving from Perl 5 to Perl 6.

Ruby

Since I'm personally a fan of Ruby I might be biased here, please keep that in mind.

To me Ruby and Python are very similar languages. Their philosophy is different, syntax is different, but Ruby programmer reading Python code is like a Spaniard visiting Italy - you don't understand everything, but it's enough to make it work. So I think why one became more popular than the other must have reasons beyond the language itself.

The first reason that comes to my mind is its origin - Ruby was created in Japan and it wasn't widely known in Europe and America until 2000-2004 when first a book about Ruby was written in English and then Ruby on Rails framework was created. By then Python was already gaining popularity in academia, while Ruby was categorized as web development language in the western world. What's more, the development of Ruby used to be often discussed in Japanese, which is perfectly ok and understandable (since most of contributors were/are from Japan), and at the same time I feel it might have impacted the worldwide language adoption.

The 2nd thing is the categorization that I mentioned above - while Ruby is a general purpose language, besides Japan it is primarily known because of Rails framework (and maybe Chef and Puppet that had their share of popularity). So while it became very popular in the age of monolith SaaS applications, when the web dev moved more to JS, there was no other niche where Ruby dominated.

There are a few more potential reasons that come to my mind, but that's for another time.

Image of an actual python with a crown drawn on its head
Python king

Long Live the King - but how long?

Python's dominance among dynamic languages and its huge growth of popularity is a fact. The question remains: how long will it last? Or rather, what next major shift in programming will change the situation again? Maybe the next generation of low-code tools? What languages will we use then? Will they be even closer to English than the languages we have right now?

I have a lot of questions and few answers. I know that with the growth of computational power of our devices, with the growth of popularity of machine learning and AI, and finally with growing need for tools that will let everyone control and program the devices we use daily, we must be and we are moving towards tools of higher level. While there will certainly be space for more languages like Go or Rust in the future, they're tools for experts, not for the masses. Python and other current high level languages feel like kind of a bridge - they can be learned faster, they look similar to English, yet they still require a lot effort to build non-trivial tools. I predict that the next languages that will take over Python and JavaScript in popularity will be vastly different and will allow us to express ourselves in a more natural, human way. Who knows, maybe they will even be implemented in Python.

Discussion

Since I do not maintain comments feature on this site, please leave a comment on HN: https://news.ycombinator.com/item?id=24529615, I'll be following that thread

Sources

Credits

Photo of Larry Wall - By Randal Schwartz from Portland, OR, USA - Flickr, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=2938351

Photo of Yukihoro Matsumoto - By Cep21 - Yukihiro Matsumoto. Originally uploaded by Cep21 to English Wikipedia., Public Domain, https://commons.wikimedia.org/w/index.php?curid=2706367

Photo of Brendan Eich - By Darcy Padilla - https://web.archive.org/web/20140209081556/http://blog.mozilla.org/press/bios/brendan-eich/ https://web.archive.org/web/20131108073412/https://blog.mozilla.org/press/files/2012/04/Thumbnail-Full_Eich_04.jpg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=31783773

Photo of Guido van Rossum - By Photograph by Daniel Stroud, first retouched version uploaded by User:Deedub1983, second retouching by User:HarJIT. - Retouching (dynamic range compression) of File:Guido-portrait-2014-curvves.jpg, itself an exposure reduction of File:Guido-portrait-2014.jpg, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=82866015

Photo of Rasmus Lerdorf - By William Stadtwald Demchick - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=34989289

Flask logo - By Armin Ronacher - http://flask.pocoo.org/static/logo/flask.svg, Copyrighted free use, https://commons.wikimedia.org/w/index.php?curid=19501815

Django logo - https://www.djangoproject.com/community/logos/

Numpy logo - https://commons.wikimedia.org/wiki/File:NumPy_logo.svg#/media/File:NumPy_logo.svg

Pandas logo - By Marc Garcia - https://github.com/pandas-dev/pandas/blob/master/web/pandas/static/img/pandas.svg, BSD, https://commons.wikimedia.org/w/index.php?curid=73107397

Tensorflow logo - By FlorianCassayre - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=58380451

Pytorch logo - By https://github.com/soumith - https://github.com/pytorch/pytorch/blob/master/docs/source/_static/img/pytorch-logo-dark.png, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=71168078

Ansible logo - By Ansible.com - https://github.com/gilbarbara/logos/blob/master/logos/ansible.svg, Public Domain, https://commons.wikimedia.org/w/index.php?curid=52280850

SciPy logo - https://www.fullstackpython.com/scipy-numpy.html

Photo of Python - Photo by Divide By Zero on Unsplash

Google logo - https://www.google.com

University hat icon - By Leon Rische https://thenounproject.com/l3kn - https://thenounproject.com/search/?q=university hat&i=463808, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=57981381

Ruby logo - http://ruby-lang.org

The Camel of Perl - https://www.perl.org/