Live data from Hacker News

What Python developers need to know before migrating to Go

blog.repustate.com

111–117 of 117 posts

Re: What Python developers need to know before migrating to Go

#111

Earlier quoted context omitted.

> I keep looking for alternative compilers and can't find any. Really??? How long did you look? I call bullshit; you did not look. GCC is an alternative compiler. Go away troll.

gccgo is still from the same google-owned go project. I'll gladly go away, fanboy.

It is a first class member of GCC, under the GNU project. There are no possible concerns. I challenge you to attempt to articulate even one. No vague "google pulls the plug" statements, articulate a specific concern. Try it. You idiot crybabies, seemingly primarily people who got butthurt at having their hosted RSS reader pulled out from under them, never can.

You are either a troll or an idiot. Actually, I'm leaning towards both.

Re: What Python developers need to know before migrating to Go

#112
post #65

Earlier quoted context omitted.

Not quite. What you have is a single type interface{} that happens to be the super type of all other types. You still haven't solved the issue of having multiple different types in a tuple--you've just thrown all the type information away! Think of a tuple as an anonymous struct. (Or perhaps think of a struct as a tuple with labels :P.) We want to statically differentiate between a pair of ints, a pair of strings and…

RTFM! of course you can, just switch on a type switch x.(type) { // cases }

The parent post said "statically".

Re: What Python developers need to know before migrating to Go

#113
post #43
post #42

Earlier quoted context omitted.

A bitvector: []bool Most of the time, you would use map[key]value rather than your own hash table or BST. If you need an implicit linked list, there is one in the standard library: http://golang.org/pkg/container/list/

Yes, I noted that list container. If I need a sorted list, do I need to do that myself (which is OK though not ideal)? Or again there is some other container that can work possibly with a wrapper around it to emulate a sorted linked list?

I think the thing to do is just to write a function to keep stepping through the list until you find the right place to insert, and then just use container/list.

Sorry to be "that guy" who questions the question, but sorted lists aren't really a great data structure. As you probably already know, insertion is O(N), where N is the total number of elements in the list. It might be better just to use the GoLRB library, which provides some always-sorted tree structures.

Re: What Python developers need to know before migrating to Go

#114

Earlier quoted context omitted.

> I keep looking for alternative compilers and can't find any. Really??? How long did you look? I call bullshit; you did not look. GCC is an alternative compiler. Go away troll.

gccgo is still from the same google-owned go project. I'll gladly go away, fanboy.

gcc is owned by Google? Someone should tell the gcc folks and Richard Stallman that.

Re: What Python developers need to know before migrating to Go

#115
post #43

Earlier quoted context omitted.

Yes, I noted that list container. If I need a sorted list, do I need to do that myself (which is OK though not ideal)? Or again there is some other container that can work possibly with a wrapper around it to emulate a sorted linked list?

I think the thing to do is just to write a function to keep stepping through the list until you find the right place to insert, and then just use container/list. Sorry to be "that guy" who questions the question, but sorted lists aren't really a great data structure. As you probably already know, insertion is O(N), where N is the total number of elements in the list. It might be better just to use the GoLRB library,…

You are right. I had a very specific case where I needed a sorted list. I do not recall why anymore.

Re: What Python developers need to know before migrating to Go

#116

Earlier quoted context omitted.

Fortunately you can embed other people's types within your own type, thereby extending it.

Sure. But that's not monkey patching, that's inheritance.

I'd say it's closer to subtyping.

Re: What Python developers need to know before migrating to Go

#117

Earlier quoted context omitted.

That's 10 minutes where I could be... you know, living my life , man. Everybody knows what + does. You don't have to teach a high schooler that "if A or B" means "if either A or B is true". They just get it. But what the heck does "if A || B {}" mean?

Actually, you do have to teach most high schoolers (actually most people) what "A or B" means. The common usage reads that as "A xor B"

In English, sure. Not so for Chinese.
Post reply on HN