Sign in
Log inSign up
Why should I switch from Python to Go?

Why should I switch from Python to Go?

detimo's photo
detimo
·May 5, 2020

It depends on what you are doing. For some reasons Python may be better than Go, for others Go may be better than Python. Let me give you some examples.

Some reasons to go for Go :

  • Anything involving massive concurrency, like network programming
  • Writing a high-performance web back-end
  • You work in a domain that the Go ecosystem supports

Some reasons to go for Python:

  • Scripting stuff like automation. Python is a lot more flexible
  • Numeric computing or Machine Learning, in this area Go is no match
  • You're doing web stuff and need MVC model and the like. Python comes with Flask, Django and other modules.

Now you can use either of them, it depends on the job you have to do. Go isn't for everything and neither is Python.

So what you get with Go is:

  • A concurrent (imperative) programming language that can be mapped to multiprocessor machines as well as, I believe, distributed systems.
  • True concurrency, no GIL
  • A very efficient mechanism for synchronization and communications
  • Stronger typing.

Some packages are not available in Go compared to Python, because Python has been around for a few more decades compared to Go.

Go also isn't OOP (object oriented) in the same way Python is. Go relies more on structs, where Python relies on the traditional OOP model.

If you have enough performance with Python, why would you change? Especially if you have a very large code base.

Related links: