Live data from Hacker News

Why We switched from Python To Go

medium.com

51–60 of 79 posts

Re: Why We switched from Python To Go

#51
post #4

> #2 Static Type System It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you. > For example it has http, json, html templating built in language natively So does Python with urllib and json modules. I don't know if it has…

> It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you. It's weirder that many Python/NodeJS switchers cite this reason, since out of all the commonly used statically typed languages, Go has the second weakest type system…

What functions return interface{}? I rarely see it outside of marshaling/unmarshaling (where I believe it would remain even if the language had real generics) and contexts (which would also use interface{} if there were generics).

Sometimes you want dynamic typing, how else will you pretty print structs? The compiler could generate code but that's a lot of bloat. For context, the point of it is that you don't know what's in it, it's an opaque container for information to be used by middleware. The fact that data might be missing lends itself to easier refactoring later on.

I want generics in go, but I don't find my code using much interface{} at all.

Re: Why We switched from Python To Go

#52

Earlier quoted context omitted.

> It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you. It's weirder that many Python/NodeJS switchers cite this reason, since out of all the commonly used statically typed languages, Go has the second weakest type system…

If you really want good static typing while being fairly python like, there are other great options. Java or c++ both have decent generics, speed comparable to go, great libraries and years of collective experience using them. I truly hate the social hacks that are causing go to displace much better languages.

It's the learning curve. If you know another imperative language, you can grasp golang in a week. With C++ or Java, you need months.

Re: Why We switched from Python To Go

#53
This article of full of fluff. Citing a static type system as a point for Go? Go's type system is about the weakest of any popular, statically typed language being written today. It's full of escape hatches.

Re: Why We switched from Python To Go

#54
post #53

This article of full of fluff. Citing a static type system as a point for Go? Go's type system is about the weakest of any popular, statically typed language being written today. It's full of escape hatches.

> It's full of escape hatches.

For people who are accustomed to Python or Javascript this is a feature, not a bug.

Re: Why We switched from Python To Go

#56
post #19
post #4

> #2 Static Type System It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you. > For example it has http, json, html templating built in language natively So does Python with urllib and json modules. I don't know if it has…

"If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you." People change. Dynamic typing was popular some years ago, but opinions have changed.

This is weird. It's not a matter of what was popular a few years ago.

Static typing didn't "stop" being popular while dynamic typing "was" popular, nor have opinions "changed". Dynamic and static typing have coexisted almost the entire history of programming and will continue to do so.

And so will the flamewars about them, unfortunately.

Re: Why We switched from Python To Go

#57
post #51

Earlier quoted context omitted.

> It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you. It's weirder that many Python/NodeJS switchers cite this reason, since out of all the commonly used statically typed languages, Go has the second weakest type system…

What functions return interface{}? I rarely see it outside of marshaling/unmarshaling (where I believe it would remain even if the language had real generics) and contexts (which would also use interface{} if there were generics). Sometimes you want dynamic typing, how else will you pretty print structs? The compiler could generate code but that's a lot of bloat. For context, the point of it is that you don't know wh…

It really depends on the type of application you're building, I suppose. I've seen applications littered with empty interfaces, and others with hardly any.

Re: Why We switched from Python To Go

#58
post #35

I've tried moving one of my projects from Django to Go before. I must accept that I had to wire a lot of stuff in Go, that Django handled for me like a cake. I'm talking about configuration, patterns and common features. Others who've been where I was: how did you cope up with this? Would you be ready to move another project from Django to Go, without the mental fatigue?

For the majority of my career I haven't worked on greenfield projects. I've been debugging, modifying, and otherwise maintaining pre-existing projects. As a result I've grown to really dislike frameworks that autowire things together. The very same features that made it easy to get started make them harder to maintain going forward. It turns out following the code in your own codebase is easier than following the cod…

Just my personal anecdote, but I recently had to port the backend of one of my pet projects away from ruby due to performance issues - parsing around 50MB of string in ruby isn't an amazing idea.

So I figured the natural choices there would be go because it's new and in demand, and java because I have a couple years of java se experience.

So, figured, let's evaluate java... and I just failed to comprehend the spring stack just from googled tutorials. There's such a dense layer of magic going on in there, I'd either need to not understand most of my stack, or spend weeks and weeks reading and understanding.

Re: Why We switched from Python To Go

#59
post #52

Earlier quoted context omitted.

If you really want good static typing while being fairly python like, there are other great options. Java or c++ both have decent generics, speed comparable to go, great libraries and years of collective experience using them. I truly hate the social hacks that are causing go to displace much better languages.

It's the learning curve. If you know another imperative language, you can grasp golang in a week. With C++ or Java, you need months.

Java is pretty darned graspable, at least I think it's way closer to Go than C++. What do you think are the biggest things that make it hard? The language? Warts like int/Integer? Library size or organization? (This is a real question, I can't look at this stuff with "fresh eyes.")

Re: Why We switched from Python To Go

#60
post #9

Point 3 Goroutines are more performant than python threads if you don't understand the difference between a thread and a routine.

How about asyncio in python 3 and gevent etc. in python 2?

Right I'm not saying that python 2/3 doesn't have these abstractions (to be honest I'm not an expert in either Python or Go, I'm a C++/Haskell guy). Just that the author is creating an obvious false dichotomy.
Post reply on HN