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,
- Python is Interpreted
- You need not compile Python Code
- Python is Interactive
- It has support for Object-Oriented Programming & Functional Programming too
- Readability at its heights
- Support of in-built libraries
3 Major downfalls of Python Language
- Python is slow
- Python doesn't support app development
- Desktop apps build with Python isn't that rich
The three main applications of Python
- Data Science
- Web Development
- 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
Top comments (7)
What is the difference between a scripting language and a programming language?
So there are a few major differences between scripting language and programming languages.
Compilation
When languages function as a programming language, they are compiled first, but when they function as a scripting language they aren't compiled.
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 😊
Well said
Thank you
Yes, thanks
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.
Well said. Thanks for sharing your experience and opinions. 🙂