Alexa metrics
Live Chat

Welcome to UKFast, do you have a question? Our hosting experts have the answers.

Chat Now
Sarah UKFast | Account Manager

DevOps Blog Series: Python versus Go

19 February 2019 by Charlotte Greene

Dev Ops CreateUKFast DevOps engineer Tim is back once again to guide us through the important decision of choosing the right programming language for you.

Over to you, Tim.


Different programming languages arouse deep and sometimes blinkered passions in the software community. At any one time, there are so many competing languages that it’s difficult to decide which to adopt for a particular project.

Getting this decision wrong can be expensive. This is not just in the short term with wasted investment in training, tools and the like, but also longer term when it becomes increasingly difficult to find people to maintain legacy systems.

Two of the key programming languages used in DevOps are Go and Python. Both have advantages and disadvantages and in this post I’m going to explore the differences between them and the sorts of projects to which each is suited.

What do they have in common?

Go and Python are both open source, so are freely available in perpetuity on any platform you are likely to use. Both are an absolute joy to program in. They’ve also reached that critical mass of adoption which means they will be maintainable in another five or ten years. They both produce highly portable code, so a program written in either will usually run without modification on any platform. But they are fundamentally different beasts.

How are they different?

Python is an interpreted language. So each time the program is run, it executes via the Python interpreter. Go, on the other hand, relies on a compiler to convert the source code into a self-contained executable program which runs directly on the computer hardware.

The practical upshot of this is that there must be a Python environment with the appropriate libraries on the target system, making deployment of remote systems more complex. This is particularly the case if the code depends on non-standard Python libraries or a feature which was only implemented in a particular version of Python.

The Go compiler performs very strict type-checking, ensuring that a function which expects one type of data isn’t, instead, passed to another. Python is much more relaxed about such things, making it very flexible. But it has disadvantages too, particularly with increasing software complexity.

Firstly, the onus is on the programmer to ensure his code performs any necessary type-checking. Secondly, as code complexity increases, the chances of there being some sort of unexpected bug or side-effect also increase.

Python ships with an extensive standard library of functions to perform many of the common operations in programming. There are also other freely available third-party libraries which further extend its capabilities. Go’s libraries, whilst very good, are not as extensive or mature as Python’s.

Python is a higher level language than Go. This means that a typical Python application will have significantly fewer lines of code than its Go counterpart. This, of course, equates to faster, cheaper development and easier maintenance.

So, which to choose?

As a general rule of thumb, Python is superb for the rapid development of richly featured applications. Its high-level nature and iterative development model, where you write a couple of lines then test them, mean that developing things like prototypes is a dream. It’s still my default language when I want to try something out or require a quick answer to a question, but it doesn’t scale well.

The nature of DevOps is that you often need to execute software on some sort of remote system. Deploying Python applications to target systems is a headache. So for anything self-contained, Go is my language of choice.

In my opinion, they’re both excellent tools. But, as with all tools, choosing the right one to use for the right type of application is essential.