Why Python !?

Ankur Singh
aiadventures
Published in
6 min readMar 16, 2021

--

In this blog we will try to answer the question, “Why Python?”. Why every beginner is recommended to start with python? Why people use python for Data Science and Machine Learning? In fact, why do you see python everywhere in 2021?

To answer this question, we will have to first answer “What is Python?”. According to wikipedia,

Python is an interpreted, high-level and general-purpose programming language.

You will find many similar definition online. But for me,

Python is a high-level programming language which is also beginner friendly.

Being beginner friendly is the most important feature of Python. Here are all the things that python does to make it easy for the beginners:

1. Installation

You will realize the focus on being beginner friendly, as soon as your setup it up.

If you a Mac/linux user, then python comes pre-installed with the OS. If you are a windows user, then you can easily install it just like any other application. Download the .exe installer from python.org, double click, press ‘Next’ a couple of times. . . . and you are done!

This is way too easy when compared to C/C++ installation on windows. Remember, windows is an GUI first OS, i.e. not very programming friendly. Though things are changing now!

2. Code Readability

Just look at the two code pieces. One is written in Python and the other is written in C.

You will immediately realize how concise python code is. It’s as good as reading English. On the contrary, C code looks much more cryptic.

There are many small things at play here:

  • Syntax is very close to English language.
  • Uses indentation instead of { } for code blocks. This much more readable and comes naturally to humans.
  • Python is both dynamical & loosely typed language. So, the programmer doesn’t have to worry much about variable initialization & their datatypes while using variables.
  • and much more . . .

Once you put all these small ideas together, you will realize that Python is super easy to get started with.

3. Running the Code

Even running python code is super duper easy! Unlike C/C++ and JAVA (compiled language), Python is an Interpreted language. So there is no need of an intermediate object code.

Single command is enough to run python code. On the contrary, you first have to compile the code and then run the object code, for languages like C/C++ i.e. two commands.

Note: This might not seem a lot but two commands every time you change the code is a lot of time. Many programmer run the same code 100s of times a day!

4. Data Structures & algorithms (DSA)

There’s a limit to what you can do with basic programming knowledge. Just knowing the syntax is not enough. You need additional know of data structures & algorithms to become a proficient programmer.

Many people learn the syntax in just few weeks but they keep struggling with DSA for life. Its difficult to master and extremely difficult for beginners.

Now python has extremely powerful & flexible data structures built into the language itself. Other languages like JAVA also have built-in data structures but python data structures are very special. Python Data structures are meant for normal Humans; not programmers. Let me explain . . .

Other languages offer data structures like Stacks, Queues, Linked List, etc. To use these Data Structures efficiently, the programmer must have at least some prior knowledge about them. Often times, programmers have to create their own custom data structure because these built-in data structures are very rigid.

Where as Python offers very flexible and powerful data structures like list, tuples, dictionaries, sets, etc. It’s been 5 years since I started using python, and I have never missed pointers or structures from C.

In python, DSA is not a separate thing to master, it’s simply part of the syntax.

And on top of all this, Python data Structures are Heterogeneous (data elements may have different data types) in nature & you don’t have to worry about memory management.

Long story short, Python is extremely beginner friendly and at the same time, it flexible and powerful for complex tasks. Hence, both: beginners & advance user, fond of python.

Sometimes, simple languages are so simple, that they can not be used for complex tasks. But not Python, it has maintained a good balance for both user groups.

Let’s now look the benefits of using Python . . .

Increased Productivity

As you have already seen, Python code is much more concise. Here are some more number to reinforce the point:

  • Python code is 3–5 times shorter than the equivalent Java code.
  • Python code is 5–10 times shorter than the equivalent C++ code.

Fewer lines of code directly translates to less errors and less maintenance. This results in faster development cycles. Evidence suggests that Python programmer can get 12 times more work done compared to C/C++ programmers. That is, 12 months of work in just one month! 🤯

Industry is moving towards . . .

As the saying goes, “Nothing comes free of cost”! Unlike other programming languages, Python while trying to abide by its philosophy of being beginner friendly, paid the price for it. As a result of automation & all the heavy lifting under the hood, Python code is generally slow & requires more memory.

But who cares, slow execution & memory was a problem in 1970 when computers had 8KBs of memory in total and can only do ~1000 operations per second.

Today, development time is the most limited resource. Because of cloud computing & virtualization, memory & compute needs can be easily meet.

In 2021, every company uses agile methodology and makes multiple release per day. Every company is experimenting with new features & products. Every company wants the first mover’s advantage. Hence, ability to develop something quickly is the most important thing.

Python is notoriously famous for its faster development time. So, everything that is to be delivered quickly (example, web development) or is short lived (example, scripting, testing, web scraping, automation), is done in Python.

All Tech startups use python. Because its easy to learn, and can be used for building products, websites, automation, testing, etc. One language for everything.

Python is used by startups and big companies, alike.

Data Science & Machine Learning

Is Data Science the next big thing? Frankly speaking, I don’t know! But its growing exponentially for the past few year, and there are no signs that it will slowing down anytime soon. Here is my line of reasoning for this rapid growth.

Data Science is a not just limited to CS and IT. It is used in Medical industry, Health Care, Automobile, Advertising, Retail, Logistics, Banking, etc. Anything industry which works with tons of data, can benefit from Data Science. Because of its wide application across many different industries, Data Science is at boom! 🌋

Python is the go to language when it comes to Data Science & Machine Learning. Python is super easy to learn (beginner friendly) when compared to other tools like R & Matlab. Python is also FREE and Open Source. And finally, its a general purpose language. So, after training your machine learning model, you can use the same language (Python) to turn it into a web-app.

Nothing comes even close. Julia is a good contender, but the python eco-system for DS/ML is very mature with over decades of development by 1000s of enthusiasts. You cannot beat Google in search, Just like that, you cannot beat python eco-system, even if you get everything else right!

Hence, with Data Science and Machine Learning, Python is also becoming a household name.

Hope you learnt something new and found your answer to “Why python?”

--

--

Ankur Singh
aiadventures

Founder aiadventures. Expertise in Machine Learning, Deep Learning, Data Science, CV & NLP. I love teaching and helping people to build career in Data Science.