4 ms·
The amount of boilerplate Go code for a simple GET is astonishing. I love Go, but sometimes I miss the succinctness of Python.
by tkiolp4 5y ago
The amount of boilerplate Go code for a simple GET is astonishing. I love Go, but sometimes I miss the succinctness of Python.
- skrtskrt 5y agoWhile Go is definitely more verbose, Python benefits from decades of development of common libraries (requests, attrs, click, SQLAlchemy, Django ORM/REST framework, etc) that have become the de facto standard - there is a LOT of code hidden behind those simple interfaces and the hyper-dynamic nature of "clever" Python libraries make them mind-crushingly hard to grok. I've developed in Python for >6 years, with tons of deep exploration of the common libraries, and been working in Go for like 3 months - in terms of my ability to understand them, I'll take most Go libraries over Python any day.
- skrtskrt 5y agoAlso note that the Python example naturally has no exception handling, while Go "has to" handle the errors (enforced by convention and linters, you could always just throw them away) also it's only one more line, but they didn't even bother to print the response once you look at the fact that Go has to have `func main()` declared, the response printing, and the error handling, Go only has a couple more lines than Python