paint-brush
Why Python is The 1st Languageby@gregorywitek
1,504 reads
1,504 reads

Why Python is The 1st Language

by Gregory Witek12mDecember 24th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Python, Ruby, PHP, Perl - all these languages share similar age and features, yet one of them is way more popular than the others. In this article I explore why

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Why Python is The 1st Language
Gregory Witek HackerNoon profile picture

Some time ago I was reflecting on the (loosely defined) quality and popularity of programing languages. In the recent years we've seen a growth of appreciation for static typing, whether in form of fully-typed languages like Go, in form of JITs introduced to PHP or Ruby, or in case of Typescript, language that compiles to another dynamic language. And yet despite this trends, at the same time 2 dynamic, scripting languages marrively grew their popularity - 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 article I'm going to try to find out and explain why Python has become much more successful than other, similar languages.

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).

On the photo, 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.

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.

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 as a few hours of research on this topic), Perl in its current form (Perl 5) kond of reached its limits. 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 the 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.

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.

Credits

Previously published at https://www.notonlycode.org/why-python-has-won/