posted: October 23, 2016
tl;dr: Five reasons why you should be using Python...
Python BDFL (Benevolent Dictator For Life) Guido van Rossum named his nascent programming language after the British comedy troupe Monty Python. So, the “P” in Python does not stand for “productivity” - but it could.
At my last company we used Python in several subsystems and were always pleased with the results. At my current startup company, Uprising Technology, Python powers the entire backend of our Cloud SaaS webapp. Besides yielding a leading-edge, responsive product that our users love, we simply could not develop the product as fast as we have been able to, with a small team of developers, without the power of Python.
There are many reasons to use Python wherever possible in your next application; I thought I’d list the primary ones here:
1. Developer productivity
You can do more in one line of Python than in one line of any other programming language. Python abstracts away many of the underlying implementation details, allowing the developer to concentrate on the task at hand. For example, pointers and memory management are definitely there, under the hood, but the developer doesn’t have to worry much about them or deal directly with them. Because Python is interpreted and dynamically typed, it is easy to write code snippets, run them and see how they work, then incrementally add them together to create a full program. You can do more productive work, and get it done faster with fewer developers, when you do it in Python.
2. Fast enough, 95%+ of the time
Many cringe when they see the word “interpreted”, thinking that Python is going to be slow. It is certainly not the highest performing language to use, but any language other than raw assembly is going to pay some performance penalty. However, programs rarely need to be optimized for maximum performance; much code just needs to run at human speeds, to provide fast-enough response to a human user. If your development team’s costs exceed your cloud hosting or data center hardware costs, you may be optimizing the wrong item when you spend more developer time trying to reduce your cloud or hardware costs. Instead, just throw some more processing power at the problem: memory and CPUs are inexpensive.
Python is heavily used in data science for number crunching, yet how can this be true if it is interpreted? The answer is that the popular Python libraries for data science, such as SciPy and NumPy and pandas, typically implement the most CPU-intensive portions in C and put Python wrappers around the C code. Thus the developers using those packages can write their orchestration code in Python while also getting high performance for raw number crunching.
3. Clean, clear syntax that spans from beginner to expert
My first programming language was BASIC, which has many well-known flaws yet one major benefit: it is super easy to learn. Python is as simple as BASIC to get started. Like BASIC, there is an interpreter which can evaluate expressions without any keywords; writing a “Hello, world!” program is just one line; and writing a loop is just two lines.
Yet unlike BASIC, Python spans the entire spectrum from beginner to expert. Python can be used to write loosely-structured scripts, functional programs, object-oriented programs with multiple inheritance and operator overloading, multitasking programs, and asynchronous programs. When people call Python a “scripting language”, they are unknowingly underselling its capabilities.
Guido did a fantastic job defining Python syntax with a bare minimum of punctuation and to make it read as much like the English language as possible, if you choose your variable and function/method names well. The use of whitespace to enforce program structure and eliminate superfluous punctuation is brilliant; it enforces the foundation of a coding style and makes it easier for developers to read and understand someone else’s code.
4. All the cool kids are doing it
Because of the reasons cited above, Python is becoming the dominant language taught to beginners in schools, from grade school (if your school district is on the leading edge) to high school to university. This means that there are more and more programmers graduating every year who know Python. For companies, this creates a growing supply of talent who can be hired and become productive quickly.
5. Open source, with lots of libraries and an active, welcoming community
Python is one of the five or ten most popular programming languages in the world, depending on which survey you read, and is growing in popularity as more people are taught it in the schools. The language itself comes with a rich set of builtin libraries and there are tens of thousands more, covering a broad array of programming tasks, available on the Python Package Installer, which can be installed with a single line command. The Python community is worldwide and is known to welcome contributions from programmers of “all shapes and sizes”, unlike some other communities which have a reputation of being elitist or confrontational. This means that the Python community and the tools available to it should continue to flourish in the future.
For these reasons and others, you should consider Python for your next project if you are not using it already.