For the past few years, I've been dedicating a good deal of time on automation and writing lawmaking to augment network services. Don't get me wrong, I'1000 still a Network Engineer and deal with networking and infrastructure problems on a 24-hour interval-to-day basis, but I as well develop and maintain applications written in Python and Go. In this post, I'll go over my feel with both languages and try to guide y'all in choosing between Go and Python.

Full disclosure – these days I lawmaking in both Go and Python and similar them both but for unlike purposes. Both languages have their strengths and weaknesses, and from a practical approach, there are some very distinct reasons to cull Go over Python, particularly in the context of Network Operations. If you lot are reading this, yous are probably coming from a Python background or trying to determine which language you should be learning first. Let'due south talk near some of the reasons why yous yous would choose Go over Python, in order of the most important first:

i. Concurrency

Go has born concurrency. If you want to run a function concurrently, it literally takes two messages to do so; merely append "Go" in front of it. From my experience, concurrency is important in the context of network operations. In Python, yous can acquire very rapidly how to connect to a device and run some commands. The problem arises when you realize that your program has to connect to a hundred or even a thousand devices. In Python, concurrency is difficult and slow. I can probably write an entire Become programme and run it on a million devices earlier y'all can figure out how to make your Python program run on multiple threads. Concurrency is and so important for my day to twenty-four hours work, especially for execution of lawmaking in a product environs, that I rate this as my #1 reason for using Go over Python.

2. Performance

Get is fast. Extremely fast. Typically at least 40 times faster than python. The performance is similar to C++. You can await at some of the performance numbers of Go vs Python hither:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go-python3.html

Merely I don't demand performance, I'm just writing a script.

Right, I go it. Maybe Go is not the all-time use-case for a script. Over again, from my experience once you lot start going downwards the coding route, you'll want to automate everything. You'll start small-scale and eventually face problems where performance matters.

Does your application need to decode network traffic and use some logic on information technology? If yeah, and then operation is important. Practice you want to parse large streams of syslog traffic? Performance is as well important. These are merely a few examples of real utilise-cases I've used Get for equally it was a better solution. Your situation might be different, or similar, it depends on how far you lot are in your journey to automation and on the bug you are trying to solve.

 3. Deployment ease and portability

Get is a compiled language. This substantially means that your application volition exist a single binary that can be transferred or copied easily to your production environment or remote devices. I lost count on how many times I ran into a state of affairs where I needed to run a Python script on a device that did not have access to the internet or the proper internal repositories.

Python besides has huge portability headaches. If your application needs to run on Linux and Windows, good luck trying to become all the correct libraries and dependencies installed!

 4. Unproblematic and readable

Less is exponentially more than.

This sentence illustrates one of the core philosophy'south behind Get's design where at that place's ordinarily just ane mode of doing things. Some of the main pain points explained in "https://talks.golang.org/2012/splash.commodity" is that Become was created to simplify readability of code past making sure that programmers don't have the option of using different subsets of the language. Go is not simple every bit in "not complex" but simple compared to languages that perform similarly like C++ or Haskell. I've found that Get is more often than not much more readable than Python and virtually as easy to learn (and this is saying a lot comparison it to dynamic duck typing language).

To give you an example, my showtime projection in Go was partially created by a Developer that did non work at the visitor anymore. Within my start week of learning Become, I was able to read and sympathise all of his code, follow the logic and brand additions and changes to get it up and running in production. In comparison, I sometimes have a difficult time following the logic of my own Python code written a twelvemonth ago!

five. Tooling

In Python yous are forced to build your own CI/CD stack. Yous demand to choose a testing library, a documentation tool, etc. and go them to all work together gracefully. With Get, everything is already baked-in and integrated, set for you to employ. This makes it easy to have a skillful practices established even on small projects.

After reading the points above and if you don't know Python yous might be thinking, Should I even acquire Python? The answer is Yes! You lot definitely should.

My advice will always be to get-go with Python. At that place's a lot more resources available for you to acquire Python as information technology is a much more mature language. It's easy for beginners to learn and many of the concepts volition translate into other languages. Once you've experimented and dabbled with Python for a while, go and acquire some Go!

I notwithstanding utilize Python quite often and so should you. Information technology is a multi-purpose language and information technology will however exist faster to develop on. The principal reason is that it has thousands of useful and available packages. It as well has been adopted past the network customs every bit the go-to language for network automation (think Ansible).

In conclusion, both languages have their own purpose. It is ameliorate to know both and to apply them for their strengths based on your development project.