~ 4 min read
Python isn’t Used in Prod
I watched a video earlier this week by comedian and mathematician Matt Parker. It’s an entertaining walkthrough of some impressive optimisation of his own Python code by his community but there’s a comment about Python that I thought warranted some pushback.
That comment was that ‘Python will very rarely make it into production’. The implication being that it’s a language used only really for prototyping at which point you’ll bring out the raw grunt of another language - such as C++ or C to do some real work. Now I and a lot of other Pythonistas who have a career at writing Python would beg to disagree and it certainly appeared that way from the comments on his video too. I get that he’s talking from his own view of a Mathematician. In this domain a large measure of how good a piece of software is its execution time and prototyping would be the common approach. But in the field of software engineering, there’s a huge number of examples where Python is used in production and it’s not just for prototyping.
A quick look at stackshare reveals 8321 companies sharing they are using Python in their tech stacks, including Netflix, Uber, Google and Pinterest. There’s also no less than 175k developers who state publicly that they’re using Python there too.
My Own Experience
Most of my own experience with Python stems from using it for the web. Python is very popular when being used for web backends and in the field of devops. There’s a whole bunch of web frameworks that exist such as Flask, Django and FastAPI that are designed to be deployed directly into production that are all written in Python. The top most used language by the Office for National Statistics is Python across their 1.2k github repos.
Python is great where business requirements may be changing rapidly and developer costs are high. It’s far cheaper to pay the costs for a program to run for a month to get to a solution than get a developer to work on it for a few days (or some cases even hours!). Compute cycles are always getting cheaper whilst dev salaries aren’t.
It’s also a great fit for data science and machine learning where it may be a wrapper around one of these more performant languages, that can do all the number crunching but Python provides a simple interface for experimentation. This is the approach taken with a library such as numpy.
Python is an excellent ‘glue’ language in other cases that need to wrap existing tools. The example I’d like to point to is that of studio pipeline development - a field where I have a lot of experience. My first job was working at Aardman Animations, where I was writing software for careful production tracking of storyboards and puppets. Since then I’ve built tooling in Python used across a number of different studios to validate that crew tasks were being performed correctly. The reason why Python is commonly used here is to interface with the many disparate applications used in the production pipeline. It’s why other studios such as the team at Industrial Light and Magic also use it. You may of heard of them - they’re the people that create groundbreaking visual effects that was founded by George Lucas to work on Star Wars.
Python can be fairly performant itself when the correct approach is used - in the example of Matt, his code went from 1 month to 15 minutes in Python when a different approach was taken which later was optimised further down to a little over a minute. Most companies don’t have the luxury of being able to jump between languages and so using a single more versatile is a better option for them.
So yeah, to summarise: Python is used in production - just maybe not yours.