For further actions, you may consider blocking this person and/or reporting abuse
Read next
System design: Building a Vending Machine in Go
Saloni Agarwal -
Supercharge Your Conversations: How to Build a Telegram Bot with OpenAI's GPT-4 (No-Code!)
Tala -
Building a Web Search Engine in Go with Elasticsearch
Ravi Kishan -
Beginner's Guide to Managing Files in Amazon S3 with Go
Ukeje Chukwuemeriwo Goodness -
Top comments (1)
It's hard to pitch against the wind, but I'll give it a shot:
I'll assume for my purposes you are asking a which, of the two, should I choose.
Each language has it's pros/cons so I will list a few for each language and follow up with my choice:
Python:
Pros:
* Easy syntax to get started with, but gets really complicated as you learn more features.
* Not having to mess with types is ok-ish if you are new to programming, but eventually you move closer and closer to type enforcement.
* Python is older than Go, so it has a much larger community and thereby, there are more problems that have already been solved with libraries.
* Classes are nice if you like OO.
* Extendable via C if you need faster code.
Cons:
* As previously mentioned, the syntax gets really hard to read as you introduce more language features (think python lambdas).
* In general, python code is just harder to read than Go.
* The language is interpreted, therefore, you have to have an interpreter to run it which means a loss of portability.
* Concurrency is a pain and learning the
async/await
syntax is just generally harder than what Go does.* Python is just generally slower than Go.
* Package management in python is a giant cluster-you-know-what.
* Lots of ways to do the same thing (though some argue this is good, it introduces a good bit of differences between you and the next python developer).
Go:
Pros:
* Syntax/readability remains mostly the same regardless of how big the code base gets, or how many language features you use.
* Concurrency is easy-ish with the
go
keyword (you still have to guarantee you are writing race conditions though).* Go comes with a lot of the common tooling you need (formatter via
gofmt
, linter viagovet
, test runner withgo test
, package management via go modulesgo mod
, etc, etc, etc...)* Faster than Python (though not as fast as C/C++/Rust).
* Can be compiled to a static binary, thereby gaining portability over Python.
* Can also be extended by C.
Cons:
* I really see this as a pro, but some coming from Python see the strong-typing as a hinderance at first, but that goes away quickly.
* No real classes, you have to use structs in their place.
* Younger ecosystem, so there are less libraries to do things (plus, Gophers use to have a "build it yourself anyway" mindset)
I actually switched from Python -> Go several years ago and I'm thankful I did so every day. Go's types make an entire class of python bugs go away and the added portability is nice. In my opinion, Go is the clear winner here.
Now, I have to caveat this with "it depends" and not only because I'm an engineer, but if you are going into Data Science or a lot of academic positions, Python is the clear winner, but Go clearly wins on almost every other front.