Tech Review Series: Python
Python is considered one of the best languages to learn for beginners due to its simplicity, clarity, and elegant syntax. On top of that, Python is often the number one choice when it comes to Machine Learning, data science, game development, or computer vision which are the hottest development trends in recent years.
In this article, we will have a look at Python and discuss what makes it so popular and versatile. Is it really a perfect programming language or are there any hidden flaws to consider? Let’s find out!
Python: a brief history and the current state
The history of Python started back in the late 1980s when Guido Van Rossum decided he needed a hobby project to keep him occupied during Christmas. So not only did Python appear due to Van Rossum’s enthusiasm but it was also named after the Monty Python TV show. Seems like a fun start for a programming language that soon overtook the development community around the globe.
Speaking more seriously, Python was created as an alternative to the ABC programming language. While working on Python, Van Rossum wanted to fix the existing issues with ABC and to create something more efficient. As a result, Python appeared. Compared to ABC, Python had exception handling, was designed for the Amoeba OS, and overall turned out to be a pretty great scripting language.
The very first official Python release happened in 1991. In addition to exception handling, the first Python version also had strings, classes, and lists, as well as lambda, filter, and reduce functions. The second Python version, Python 2.0, was released in 2000. Its functionality was extended with comprehensions, garbage collector, and Unicode support.
The next version, Python 3.0, was released in 2008. Even though it was quite similar to the 2.0 version, the main difference was that in Python 3.0, the print statement got replaced with a print function. Since then, Python has had many micro-versions released, with 3.9.1 being the latest one (released in 2020 on December 7).
In 2019, there were about 8.2 million Python developers. It is hard to give an accurate estimate though as the number of developers who use Python keeps growing in a steady manner. As for the big brands that use Python, the list of names includes Netflix, Reddit, Google, Facebook, Amazon, Quora, Slack, Intel, Nasa, Dropbox, Ebay, Instagram, Stripe, and Spotify. Python is considered one of the most recommended languages to learn in 2021 as it sees high demand and is used in the hottest development trends such as data science and AI.
Python: technology type
Python is a general-purpose, high-level, object-oriented scripting language. One of the most distinctive Python features is its high readability and clarity: it often uses English keywords instead of punctuation, has a clear structure, and a clearly defined syntax. This is the reason why many beginners choose to learn Python as their first programming language - it’s very developer-friendly and easy for understanding.
Other features that Python is known for include:
- A large standard library: it supports many platforms and many common programming tasks,
- IDLE: a bundled development environment,
- Interactive mode: allows easy testing and debugging of snippets of code,
- Scalability: can be easily scaled by adding extra modules that are implemented in such languages as C++ or C.
- Portability: Python runs on various hardware platforms and its interface remains the same across all platforms.
Python Package Index
The Python Package Index (PyPI in short) is a repository that stores a great amount of ready code and libraries for Python. There are now about 235,000 packages available in PyPI while there were only 10,000 in 2010.
PyPI stores packages in the form of archives called sdists which stands for “source distributions”. As well, the packages can be stored in the form of precompiled “wheels”. PyPI allows developers to submit any number of versions of a distribution to the index. If a developer needs to tweak the metadata for a certain version, they can submit this version again - in this case, the index will be updated.
In order to search for a package in PyPI, developers can use keywords or filters against their metadata. Such an approach makes PyPI easy to use and incredibly developer-friendly. As well, it is also worth noting that a single entry on PyPi can store all the previous package releases, precompiled wheels, and different forms for different OSs.
In general, PyPi offers developers the following perks:
- Easy sharing of the code,
- Upload of the code with a single function call,
- Easy library installation,
- Simplified Python packaging process.
The use of Python: most common cases
For many, Python is associated with machine learning but there are more scenarios for its use. Let’s take a look at all the use cases where Python shines out the most.
Machine learning has many subsets, with image recognition and computer vision being among the hottest technology trends these days. Think of the analysis of X-ray images in healthcare - and that’s just one example of computer vision. And guess what’s the most popular tool for machine learning? TensorFlow that is written in Python!
Though the applications of TensorFlow are not limited by image recognition, it was designed specifically for training deep neural networks. As for Python itself, it has an impressive set of libraries that are just perfect for ML:
- Scipy: best for advanced computing,
- Keras: best for deep learning,
- TensorFlow: great for deep learning,
- Pybrain: same as TensorFlow, used for machine learning,
- Scikit-learn: used to handle ML algorithms.
Python has a really good visualization library so another popular application for Python is data science and visualization. There is a huge variety of possible data visual representations that you can create with Python, from pie charts to 3D plots. As well, you can also add text, annotations, shapes, collections, or animations to your charts which is also a big plus.
Same as for ML, there is also an impressive set of libraries specifically for data analysis and data visualization. Python libraries for data analysis include NumPy and Pandas, while the ones for data visualization are Bokeh, Matplotlib, and Seaborn.
Python is used for back-end development and can efficiently handle the server-side part of the web apps. There are several Python frameworks (Django, Flask, Pyramid, Bottle) that make Python a good choice for creating robust and scalable web apps in terms of back-end development.
Considering the vast availability of tools such as libraries and frameworks, Python can be used to develop basically any type of web app. As well, many Python tools are very lightweight and quick which is an additional advantage.
Internet of Things
Working on IoT devices brings in a whole lot of challenges, such as the development of new communication standards in the network, reduction of costs of sensor integrations, reduction and management of energy consumption. Thus, developers have to find an efficient tool that would help resolve at least some of these issues. And Python is actually one of the most suitable options.
Python allows developers to implement business logic directly at the device level. This approach allows to reduce the volume of data that developers work with. As well, many Python packages are suitable for IoT development, including:
- mraa: provides support for communication protocols (SPI, UART),
- sockets: facilitates networking over TCP/IP and UDP,
- numpy: used for scientific computing (but much lighter than MatLab).
Python Pros and Cons
While Python is a powerful and efficient programming language, it’s not a cure-all. Python has certain limitations and may not be suitable for some programming tasks - though the number of its benefits outweighs the cons.
After learning strongly typed programming languages, I found Python too simple and unsuitable for enterprise development at first. My first thought was that the use of interpretable dynamically typed programming language would cause real-time errors in production code and would make code execution speed slower.
But after 5 years of working with Python, my opinion has changed completely. Python is a universal tool for developing web services from scratch, automating routine business tasks, and working on machine learning and IoT. It is versatile, neat, easy to use, and highly readable.
Today Python is one of the most popular programming languages used by the largest companies in the world, including Google, Facebook and Amazon. It is a picture-perfect solution if you want to launch a startup product (as Python allows a quick start) or to automate business processes in your company.
Ali, Python Engineer
Python is a versatile, elegant, and clear language that is used in many applications and is loved by developers worldwide. We highly recommend using it for your next machine learning or IoT projects though for the back-end development we’d consider a different option.
We hope you enjoy our tech review series - let us know in the comments what language we should review in the next article. Don’t forget to sign up for our newsletter and stay tuned!
SoftTecoView all articles by this author.