Python is general purpose high level programming language. It was created by Guido van Rossum and first released in 1991. Since then, it's around developer community.
In recent years, with AI getting popularity, python has become very popular. Almost, everyone uses python. At HackersFriend, we too heavily use python for our daily development works and for automation of a lot of small tasks.
While python has a strong community support, wide range of libraries and easy to understand syntax style, it is very slow. Like super slow. But, why it is this much popular despite being slow, that's a very common question raised by several developers.
There are many reasons for python for being slow.
- Python is high level programming language - The syntax of python is very much human readable and it comes with a heavy price. A lot of things are abstracted like memory management, pointers and lot of things.
- Python is dynamically typed - You dont declare variable types in python, do you ? That too comes at a price, cpu has to work more to identify which variable is of which type.
- Python is interpreted language - Python codes are not compiled and coverted into some smaller and light, assembly or dll files. They are executed by interpreter as it is, line by line.
Now, comes the question, even when python is slow why it is so popular ?
Primary reason for this is, end users dont care how much slow python is, because it works like a charm and makes things simple.. very very simple.
Makes things simple
With a strong commnunity support and wide range of libraries and simple readable syntax, python makes things simple for everyone. Devlopers can build things faster and they dont need reinvent wheel for a lot of things. When you have a tight timeline and a huge set of deliverables, trust me python will be your saviour. Dev commnunity has realised and CEOs too understand this, that's why most of the devs are now prefering python as their primary language.
Business Execution speed > Code Execution speed
Every extra day or week you delay in delivering the items, it costs a lot to business and its more important than a few fraction of seconds in exeution time of code. Python allows fast developement of products.
Can be faster also
There are ways to do architect your technology stack to make python work fast while taking advantage its rapid developement.
Should you use python for speed intensive apps ?
I dont think that would be a good choice, things like games and other apps, where speed matters a lot, and lack of it can kill the entire User exeprience, I'd recommend faster languages like C#.
You see python is powerful, easy and very productive, but slow. It's all about what kind of application you are developing. If you application requires a huge computation and needs to fast at the same time, It'd be a good choice to spend some extra time and build your app in other faster languages.
However, if your app doesn't needs to really fast, you can leverage the rapid developement and producitivity of python.