DEV Community

Cover image for Why and where Python?
Tharun Shiv
Tharun Shiv

Posted on

Why and where Python?

If you have started learning Python or just Learned the programming language, you should have probably wondered “Where in the world should I use Python while there are other Programming Languages?” — Let's find out the answer.

Some reasons why Python is widely used,

  1. Python is Interpreted
  2. You need not compile Python Code
  3. Python is Interactive
  4. It has support for Object-Oriented Programming & Functional Programming too
  5. Readability at its heights
  6. Support of in-built libraries

3 Major downfalls of Python Language

  1. Python is slow
  2. Python doesn't support app development
  3. Desktop apps build with Python isn't that rich

The three main applications of Python

  1. Data Science
  2. Web Development
  3. Scripting & Other uses like GUI, Gaming, and embedded systems.

1. Data Science

Data science is using data to get inferences or predictions from it.

But why Python?
So there are lots of numerical computations. Though it seems like it could be implemented in any other language ( which is actually true ), doing the same in Python is easier. Why? The reason is that you have a lot of libraries ( pre-written set of codes that have functions and methods which could be used to write faster code with probably better space and time efficiency ) in python.

So you can apply the numerical concepts to

  • Recommender Systems ( Netflix, Amazon, YouTube rules using this concept )
  • The Google and Siri Digital Assistants
  • The Face unlocking feature (though it may seem more of hardware-oriented)
  • Email Spam detection

What is the other cool thing about Python and Data Science?
You can plot colorful graphs. Yes, using libraries like matplotlib visualize data and continue with your further analysis. You can easily plot Pie Charts, Bar Charts, Line charts, Normal Plots, Grouping & Clustering, and lots of other Data Analysis stuff in less than 5 lines of code ( Only the Plotting ).


2. Web Development

This is probably the most exciting section for web Developers ( smile ). Yes, Python has two popular Web Frameworks called Django and Flask. Of course Web2Py for honourary mentions.

What are Django and Flask used for?
They are web frameworks that are used to write server-side code ( Backend ) using Python. If you do not understand what I mean, this just means that they are used to write the instructions which for instance verifies your Username and Password match by taking the input from you and searches the storage for the correct Password and compare the True Password and the entered Password ) and such background works.

Now why can’t I use my own code for that?
Of course you may, but why do you wanna re-invent the wheel? These web frameworks make it easy to build common backend logics, communicate with the database, generate HTML files that users see on their browsers.

Django vs Flask

Django — If you have planned to build a mail service/blog / e-commerce website, where you have an admin interface.
Flask — If you build something creative and want more flexibility in each component you use. If you want to build a REST API service. Easier to learn than Django.


3. Scripting and Others

Scripting here refers to writing programs that automate tasks. (mostly repetitive )

Let's look at examples,

  • If you have a set of URLs that need to be opened at certain intervals, maybe to test the website. You can do that using small scripts in Python.
  • Selenium for Python lets you automate browsing or performing tasks on Websites.
  • If you want to filter the email containing certain keywords in their subjects, you can do that.
  • If you want to automatically go through the web starting from a single web page automatically and collect only certain information from them and store them, Yes you can do that, called Web Scraping.
  • You can use Python for embedded systems like the Raspberry Pi.
  • You can use PyGame to develop games.
  • You can build Desktop Applications using Tkinter, Python for GUI.

Conclusion

So these are the most popular uses of Python and Probably the reasons why Python is popular today. Some of my views may differ from yours which is totally fine. At the end of the day, Every Language has its own purpose out there

Just choose the appropriate programming language for your application based on how the application is going to perform and it's domain requirements. No programming language is better than others, each one has its purpose.


Article Originally written at https://tharunshiv.com

[deleted user] image

[Deleted User]

Top comments (7)

Collapse
 
chandrika56 profile image
Jaya chandrika reddy

What is the difference between a scripting language and a programming language?

Collapse
 
developertharun profile image
Tharun Shiv

So there are a few major differences between scripting language and programming languages.

  1. Compilation
    When languages function as a programming language, they are compiled first, but when they function as a scripting language they aren't compiled.

  2. Speed of execution
    Compiled languages are faster when compared to the uncompiled ones.

A programming language is mainly used to write code which takes in inputs, processes and gives outputs or does tasks.
A scripting language is mainly used to write scripts which are run when certain event takes place and does some action. Something like automation, jobs etc.,

Hope this helps 😊

Collapse
 
venkat121998 profile image
venkat anirudh

Well said

Thread Thread
 
developertharun profile image
Tharun Shiv

Thank you

Collapse
 
chandrika56 profile image
Jaya chandrika reddy

Yes, thanks

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

An often said downfall of Python is GIL -- CPython actually. Threads are lies, although multiprocessing is real.

One thing I don't like about Python, is IDE integration is never as rich as TypeScript or Java/Kotlin.

Collapse
 
developertharun profile image
Tharun Shiv

Well said. Thanks for sharing your experience and opinions. 🙂