Why Learn Python?
Thomas J. Kennedy
1 Motivation & Perspective
You may have asked yourself
Why should I learn Python if I already know Java?
or
Why should I learn Python if I already know C++?
My elevator pitch would include discussions of prototyping, data science, machine learning, web programming, and automation. Yes… that is dangerously close to buzzword soup.
2 Readability
Python is a general purpose programming language (just like C++ and Java). However, Python often reads like pseudocode or, sometimes, plain English.
Take a moment to consider the following code snippet…
print(sum(range(1, 101)))
In the code we… print
the sum
of the range
of numbers from 1
up to (but not including) 101
.
Of course… that is a bit of a forced example… and borderline disingenuous. A simple one-line program is not representative of Python as a whole. However, Python tends to be an order of magnitude more readable than C++ and Java.
3 Prototyping
Python can be used to prototype software, including
- web applications (with frameworks such as Flask or Django)
- web scrapers with BeautifulSoup
- numerical analysis and regression (with NumPy)
- data analytics (with Pandas)
- generate graphs (with matplotlib)
4 The Real Reason
No matter how much anyone tries to describe the benefits of Python, the flexibility of Python, or the number or libraries available in Python (via pip)… the real reason to learn Python is accessibility.
Python allows for procedural, objected-oriented, functional, or (even) scripting style code. Anyone with an honest interest in Python can one of the many beginner-friendly books (e.g., Automate the Boring Stuff with Python) and write their first program in a weekend.