Python first came out in 1991. It was built as a general-purpose programming language, so it can be used to solve any problem that can be quantified and described in code.
The tech market has seen a big surge in Python’s popularity in recent years. It was already popular thanks to web development frameworks like Django, and because it was popular in the academic environment. Then it became the language of choice for machine learning and data processing, which further increased Python’s popularity.
The cool thing about Python is that it’s used by many scientists and researchers. For people well-versed in the complexities of science, Python is an easy language to learn, even if they aren’t particularly tech-savvy. It’s very useful for fast prototyping, which makes it even more appealing for scientists.
It’s all because Python is one of the simplest languages, but it’s a kind of easy-to-learn, hard-to-master sort of thing. Even if you’re not a programmer, but you want to automate a simple process—like scraping data from a website, or moving data from one program to another—it shouldn’t take you long to get Python to do the work for you.
And if you put the time in and really master Python, you can use it to build a wide variety of software.
For several years, its popularity was growing at a pretty stable pace. One of the first libraries that removed the issue of cross-browser compatibility was jQuery, released in 2006. It made it easy to add interactivity to websites. The next major framework was AngularJS. It was later replaced by Angular 2+, which is still very popular in enterprise-scale solutions.
When a mission-critical component or system breaks down for too long, your whole project goes belly-up. This is the part where choosing the right technology really matters.
With low-priority systems, you can browse around, try different options, and optimize costs. When you try to do that with mission-critical systems, you might end up writing a death sentence for your project from the start.
For example, when you’re managing a mature photo- and video-sharing application with over 1 billion users worldwide, the servers that process the incredibly large amounts of content are mission-critical. The app that I’m thinking of is of course Instagram, or “the world’s largest Python site.”
As one of Instagram’s engineers put it, “Instagram Server is entirely Python-powered.” The Instagram server application is a “monolith, one big codebase of several million lines and a few thousand Django endpoints.” Every single photo, video, and like goes through the most popular Python web framework Django, as another Instagram engineer mentioned in a presentation.
Instagram uses a big chunk of servers at the massive Facebook-owned data centers. Engineers don’t just manage the looks of the app, how your feed works, or the content suggestion algorithms. They literally have to make sure that the CPUs of their servers don’t overheat.
That’s an extremely difficult task. Why did they choose Python as the main language?
The answer can be found on the Instagram developer blog: “We initially chose to use Python because of its reputation for simplicity and practicality, which aligns well with our philosophy of ‘do the simple thing first.’ But simplicity can come with a tradeoff: efficiency.”
Simplicity and practicality. Martin Fowler, a true software development guru with decades of experience, and author of several books, once wrote, “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
Which means that even when your goal is to make sure that machines don’t overheat from serving billions of users everyday, you don’t achieve that goal by being a better machine whisperer. You do that by writing code that other developers can easily understand, so they can quickly debug it if necessary, or build on top of it without wondering if they’ll break the system.
Python is perfect for this purpose, because of its readability, cleanliness, and ease of understanding.
They could’ve used another approach, like building separate interfaces in Swift and Java. But they chose the middle option, and went for React Native. Maintaining interfaces in Swift and Java, with support from React Native, allows Instagram developers to optimize costs and development time, making their life easier.
The statement is simplified because if you were to get into the specifics of how they use different programming languages and tools, you’d quickly get overwhelmed with the complexity. Plus, they’re not as keen as Instagram on sharing details about their stack with the whole world.
But again, this isn’t mission-critical. The mission-critical parts of PayPal are hidden under all of that, a lot of it coded in Python (and most likely several other languages), and taking care of security, stability, and data management.
On the other hand, Python was designed as a general-purpose programming language. It is used far beyond web development. It’s strongly rooted in the academic community. While it can be used to build a great website, with Python you can also build neural networks for developing new drugs or AI technology that hides in the heart of apps like Uber.
As Towards Data Science puts it, “Python is comparatively slower in performance as it processes requests in a single flow, unlike Node.js, where advanced multithreading is possible.”
There are ways to optimize Python’s performance by taking advantage of the fact that it uses the C programming language under the hood. For example, NumPy comes with optimized C code that makes Python code faster. Cython is a compiler, and a superset of the Python language that enables developers to build fast C modules that speed up the execution of Python code.
Python works well in CPU-intensive situations—like a machine learning model that needs to crunch a huge amount of data to solve a specific problem. It’s also a good language for doing heavy computations using GPUs.
Then again, Instagram’s server is more of an I/O intensive situation, but it uses Python. It goes to show that if you know how to optimize Python, you can make it perform quickly.
What about the other side of performance: time-to-market? Both languages can be used to quickly build a simple MVP as long as it’s done by good developers. For complex programs, Python makes for a quicker time-to-market because it’s easy to read and easy to debug. Python fosters smooth collaboration.
Python is the main language of choice for machine learning developers. It makes a lot of sense. Machine learning is complicated and involves huge amounts of data. Python is a simple and readable language, so it makes life easier for developers by removing complexity, and it has always been the standard for data science.
The most popular ML frameworks—TensorFlow, scikit-learn, PyTorch—are mostly based on Python, and provide dedicated Python APIs which are the most popular way of using them. TensorFlow did release a JS version of the framework in 2018, and it allows developers to build machine learning models that work in the browser or in a Node.js server.
But that’s not enough to win over the ML world. Python is perfectly suited for machine learning, and it’s unlikely to be supplanted by another language in the near future.
And it’s exactly those differences that allow these technologies to perfectly supplement each other in the modern world of programming.
As for Python, it’s most likely going to continue to dominate the machine learning market, as well as academia, because of Python’s readability and ease of use, as well as its power for manipulating data.
In the end, the choice of your tech stack will always depend on the nature of your project, availability of programmers, and multiple other variables.
Are you thinking of building, expanding, or refactoring software in the technologies we mentioned? We’d be happy to support you with dedicated developers.
If you’re not sure about your tech stack yet, we can advise you on the best architecture to fit your idea.