A brief Introduction to Python
What Is It?
Python is a weakly-typed, general-purpose, interpreted programming language.
It’s fairly easy to learn, so you can get started quickly. It's also quite high level, so it's easy to be productive with it.
You can use it for data science, analytics, batch processing or almost anything else.
When Should I Use It? And When Shouldn’t I Use It?
You should use it when you want something written quickly, like a one-off piece of custom software, a proof of concept, or an MVP for a start-up.
You shouldn’t use it if you need something that runs quickly.
There are plenty of articles around saying things like “How Company X Handles Billions Of Transactions With Python”; this is normally because they have an insane amount of hardware running it.
How Do I Get Started?
Download a Python interpreter from https://www.python.org/downloads/
There are third party packages (libraries) that implement most of the common functionality you’ll need – from basic things like networking (requests) to frameworks forming the basis of web applications (Django) and Machine Learning (TensorFlow). Visit PyPI - the Python Package Index – to download almost any third party pack, or list the packages in your project’s
requirements.txt file to ensure it gets downloaded automatically.
Python is a little unusual in that code is normally run in virtual environments, rather than just from a folder within the main operating system. This means you can have each application that you’re developing using a different version of Python and/or using different packages, or different versions if the same packages. If you want to develop using Python 3.8 and Python 3.9, using packages that are incompatible that’s not a problem.
There are two versions of the language in current use – 2.7 and 3. Although version 2.7 reached end-of-life on 1st January 2020, there are still legacy applications running with it. Those are generally being updated to version 3, and this isn’t surprising given the quantity of software that many companies run. If you’re writing your own software though, stick to the latest version 3.
Who Uses It?
Lots of people and organizations use Python – it’s apparently the most popular development language in the world at the moment.
Summary of Features
|Feature||Notes||What This Means In Practice|
|Typing||Loose/Weak||Strongly-typed languages prevent you from assigning one type to another, and generally carry out a lot of error checking at compile time. Loose or weakly-typed languages carry out more checking at runtime.||Strongly-typed languages will fail due to type errors during compilation, before they’re deployed. Loose or weakly-typed languages don’t fail until they’ve been deployed.|
|Language Level||High||The higher-level a language is, the abstract its instructions and concepts are from the actual low-level instructions that are actually run on the CPU.||High-level languages generally let you do more with fewer statements, at the expense of some flexibility. On the other hand, if you want to do something that’s not included, you’ll probably have to write some code of your own.|
|Compiled or Interpreted||Compiled to byte code on run in virtual environment.||Compiled languages are converted once to executable binary code by a compiler. They are faster than interpreted languages, which are converted to binary code every time they are run.||Depending on the language implementation, Python can be run as byte code or fully compiled.|
But What Do You Really Think?
Python is a good language when you play to its strengths. It’s very productive – you can put together complex systems from readily-available parts quite quickly. Performance can be a problem, but many large complex libraries are written in C and compiled on the target machine. This in itself can cause problems, but there are always people who are happy to publish articles on how to get around these problems! (Perhaps Creating An AWS Lambda With Dependencies Using Python, Creating An AWS Lambda With Dependencies Using Python, Part 2 - Fixing Import and Undefined Symbol Errors or Cannot Create a Python Virtual Environment On Ubuntu - ensurepip is not available)
If you’re developing a batch processing system, or you want to develop a web-based system or one that does machine learning or image recognition, Python is probably worth a try. If you want to actually write a machine learning or image recognition system yourself, or you need to wring as much power out of the CPU as possible, use something else.