The Popularity of Python - Myth or Reality?

With a simple Google search, we can see why Python is said to be one of the most popular and widely used technologies today.

The Popularity of Python - Myth or Reality?

written by Vlad Petrean (Java Software Engineer), in the May 2022 issue of Today Software Magazine.

Read the article in Romanian here

The year 2015. The first year of college. All the computers in the programming labs had only C, C++, and possibly Java installed, typical for learning to program both imperative and object-oriented.

Three years later, one of the questions frequently asked in early interviews was, "Do you know Python?". And the answer was: "No, but I can learn". That said, I started developing my first Python application a month after being hired.

Background

With a simple Google search, we can see why Python is said to be one of the most popular and widely used technologies today. Indices such as Tiobe.com or PYPL (Popularity of Programming Language) rank Python at the top of the list.

To explain this situation, we should look at the last 4-5 years, specifically 2018, when a boom in usage started. Why then? I believe this is due to several factors, which are also the advantages of using this technology:

  1. The simplicity of writing code and the reduced time required;

  2. A multitude of libraries and frameworks along with a large community of programmers;

  3. The rise in popularity of artificial intelligence in recent years;

  4. The growing number of IOT devices that can be programmed in Python;

  5. Continuous optimisation and performance growth of the technology.

At one point, Bill Gates said, "I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.". The simplicity of the Python language can be described by this quote, namely that it is a "lazy" language, but it does its job well. Also, in addition to the fact that a .py file achieves our desired goal, this technology helps us save the actual code development time.

Of course, there is a trade-off. Those who are fond of other programming languages can rightly claim that the runtime of languages such as C, Java, Rust or C# is much shorter than the subject of this article. For example, if we have a 2048 x 2048 matrix and do multiplication operations on that matrix, we would get the following times: Java - 84s, C - 198s, Python - 2821s.

The slower speed compared to the other two languages is due to the lack of parallelism and its status as an interpreted language and not compiled. Currently, implementing threads in Python only allows them to run in a concurrent mode, not parallel.

However, the speed of code execution has not yet led to a decline in popularity. With the development of technology, many new libraries and packages have appeared, designed further to help the development process in time. For example, some of the most popular frameworks for Web application development are Django and Flask.

While Flask is meant for developing small Web applications, Django, on the other hand, allows the creation and development of complex web applications, with some beneficial features already built-in, such as Django Admin or Django ORM.

As a slight aside, Django is the framework in which I developed my first Web application to manage a company's advertisements and promotions. Regarding that application, in a Django project, you can create the backend and the frontend part of the application, making it easier to get familiar with the HTTP protocol and REST standards.

On another note, Python has shown me that it is a language that can be easily integrated into projects with different core technology stacks. One example is the project I'm working on, where the client is one of Europe's largest electronics retailers. Here, most of the microservices are developed in Java with Spring Boot. These are interconnected with each other either via Apache Kafka topics or REST requests.

In this context, Python has been used for several purposes: for testing, automation, various alert mechanisms and data analysis, etc. The testing of microservices has involved validations in terms of their stability, i.e. simple requests, and the correctness of the data, i.e. comparing the data received in response with the data in the source database.

An example of automated data processing using Python consisted of consuming files from an sftp server and inserting the data from these files into a database. Of course, when discussing automation, in this case, a successful combination to achieve this goal in the easiest possible way is Jenkins combined with Python.

In many situations, Jenkins jobs running py files in the background are a practical choice. Because there are a lot of libraries available on the internet, we were able to implement various alert mechanisms through emails or chat tools. For analysing large volumes of data and validating their integrity, it was decided to use the Pandas library, with which you can easily manipulate datasets.

Another important factor behind Python's rise in popularity today is, as you might expect, the field of artificial intelligence. Many famous libraries or frameworks are developed in this language. Why is Python, as previously mentioned, not such a fast language? After all, an artificial intelligence algorithm involves many complex operations, most often preceded by the processing of a large data set.

TSM-May-2022-issue-1-1.png

So Why Python?

I think the main reason is that Artificial Intelligence algorithms, whether we refer to Machine Learning or other branches of AI, are more easily implemented in a pseudocode-like structure. This allows for increased code readability, which facilitates the process of developing AI algorithms. In this respect, the most popular frameworks such as TensorFlow, Keras, ScikitLearn, Pandas, and Numpy have been developed in Python.

Another area where this technology is starting to be used more and more is start-ups. The reasons behind the decision choosing Python as the right technology for a start-up have already been mentioned in the previous paragraphs. Besides, remember that the programming language is open source and costs nothing to install. You only need an internet connection to download the installer from the official website. Even more, Linux distributions come with Python ready installed.

Regardless of the business area of the start-up, this technology allows the flexibility to deploy a wide variety of applications. One such example is the Raspberry Pi. These boards can be programmed in Python and used to implement cool things like voice assistance, home security, face detection, and weather tracker.

But there remains a question I asked colleagues at one of our technical debates: "Is Python a suitable language for someone who wants to learn to program?".

Opinions were divided, which was a positive thing. I think the answer to this question is a bit more complicated than a simple YES or NO. It depends on the person who is put in that position.

From a certain point of view, starting with a programming language whose syntax is stricter in terms of writing code is recommended.

For example, as a beginner in a language such as Java, you will have the opportunity to become familiar with data types when declaring variables, organising code using curly braces, access modifiers, etc. Even if this implies additional difficulty when learning more, I find the result is especially beneficial when a programmer decides to learn a new language or technology. A drawback of this choice would involve more time in the learning process.

At the opposite pole is Python - a syntactically permissive language that allows for high readability. This makes it easier to describe and understand if, for, while etc. commands. Furthermore, you can learn to program in object-oriented and sequential or functional styles in Python.

Conclusion

Finally, Python is one of the dozens of solutions currently available. Is this technology one of the most popular compared to others on the market? I say yes.

Is this technology the best solution to solve software or hardware problems? It depends on the situation. Currently, I think Python can be compared to languages like Java, C or Javascript in terms of popularity but not performance. There is still work to be done on the performance side, but which programming language is "perfect" in all respects?

With all these performance costs, Python's advantages will help it maintain its popularity in the coming period. Also, this popularity and the community built up around the technology will inevitably lead to optimisations and increased performance.

That said, I would like to conclude with two questions:

  1. Is Python a future language, or is it living its moment of glory now?

  2. What is the connection between Python and the beginning of democracy in Romania?


Join our community of problem-solvers