Live data from Hacker News

Why I went from Python to Go (and not node.js)

orel.li

181–190 of 202 posts

Re: Why I went from Python to Go (and not node.js)

#181
post #90

Earlier quoted context omitted.

"Everyone less nerdy than me is stupid and everyone more nerdy than my is a no-life". I think it's pathetic, not funny.

I read that quote from the article as essentially self-pardoying. The author is essentially making fun of himself and the general attitude he--and other Pythonistas, I imagine--held. Then again, maybe I'm reading too much into it. For the record, I think Haskell is a strictly superior choice to Go, so I'm what he would probably call "gray-bearded" :P. (And I'm certainly working on a beard, even if it shouldn't be gra…

>maybe I'm reading too much into it.

no, you got it. It's not really meant to be a criticism of Python itself, it's just behavior that is common among 20-something web developers, which is representative of some areas of the industry, and is specifically the target audience for the post. You know, the kind of developer that is advanced enough that they can build non-trivial projects, but not experienced enough to have wisdom forged in the furnaces of years of industry experience (that's ... me and a lot of other HN users). The same type of attitude can be found in all languages and isn't specific to the Python community; the specific swipes at other languages are just what you get if you apply that attitude to Python. Judging people by the tools they use is a pretty useless metric.

>For the record, I think Haskell is a strictly superior choice to Go

I'm pretty sure it's the best programming language, that's why I put them in the gray-beard category. Or maybe it's OCaml or some Lisp dialect; it doesn't really matter. It's even why I further apologized to Dons and acknowledged that Haskell programmers tend to be able to solve harder problems than other programmers I know, but even after I twice acknowledged the superiority of Haskell, he basically just looked at me and said "you're a stupid idiot, and by the way, look at how many numbers I can compute with my superior Haskell program that runs on a lot of machines". Uh, ok, that's cool... I guess.

But every time I sit down with Haskell programmers and they explain to me how elegant their code is, I just don't really care. It's not what makes me interested in computer programming. I don't really care to use the best programming language; I really only care to make the best programs. PHP (and other shit technologies) have shown us that you don't need to understand monads to make people happy.

A friend of mine, who is a very strong programmer that I have a tremendous amount of respect for professionally, once showed me how to use Coq to prove that multiplication is commutative. I found that very boring, and it didn't make me want to learn Coq. Mind you, I spend between 40 and 60 hours a week working with software. I'm in it because I like to build things that are useful to people, and I think software is a great creative medium. I think that's a fairly common attitude.

Every time I say the name Haskell I am sorry for it, because every time I say the name Haskell I am met with bitter condescension. It makes me sad that despite talking about having experience with seven programming languages in my post, or mentioning having built a variety of things that are very different, Haskell programmers consistently treat me like I am a stupid person. So I'm glad you're not like that, and I'm glad that you understood I didn't mean to dismiss Haskell on technical grounds. Thank you for your comment.

Re: Why I went from Python to Go (and not node.js)

#182

Earlier quoted context omitted.

There is no 'horrible gotcha' with tuples of one element. Have you even tried generator expressions? Do you have any specific performance problem, or do you just suppose that you couldn't write sufficiently performant code in Python? Overall, from your post, I don't believe you have used Python seriously. I don't care what color Python would be, nor would I care what ice cream flavor it would be. Nor do I care whethe…

For what it's worth, I've used Python professionally and in several classes. I certainly don't have much experience in it, but it would be odd if I did--why would I use a language I don't particularly like too much? You only say there are no horrible gotchas with tuples because you've never spent hours hunting down a bug and finding that you forgot a trailing comma. More pertinently, changing something like ("foo", "…

I'm so confused. You seem to be saying that

> 4 * (3+2)

should throw:

> TypeError: unsupported operand type(s) for *: 'int' and 'tuple'

???

I beg to differ.

Re: Why I went from Python to Go (and not node.js)

#183
post #107

Earlier quoted context omitted.

since Python is a thoroughly mediocre language. Care to elaborate?

Is there anything to add? It's not very fast. It does not have any interesting abstraction. It doesn't push the envelope further. It doesn't allow any clever optimizations. It has a bunch of horrible gotchas (scoping, mutable default arguments, tuples of one element...). It isn't elegant--the grammar alone takes pages and it's just a loose collection of mostly orthogonal features with largely arbitrary (but, admitted…

I don't always code Python, but when I do I don't complain much about these issues :-).

I think everything you've mentioned is pretty defensible, particularly the readability bit. Honestly if a language does everything reasonably well, I think that's pretty awesome. I'm also curious what magical dynamically-typed interpreted language you prefer. The only mainstream general-purpose alternatives I can think of are Ruby (which is basically alternate-universe python) and Perl (which seems strictly worse), or are you into JavaScript or APL-derivatives? It's all a matter of taste of course, but I could probably write a much more vicious rant against any of those.

Re: Why I went from Python to Go (and not node.js)

#184
post #143
post #83

Earlier quoted context omitted.

I assume they depend on macros to do so? That changes the game. Hans Boehm has an excellent paper on this issue titled "Threads Cannot be Imlemented as a Library": http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf That paper was published in PLDI ( http://dl.acm.org/citation.cfm?id=1065042 ). His arguments have much to do with what the compiler doesn't know, which could potentially be solved with macros.

But these arguments are pretty much invalid today: C++11 introduces explicit support for concurrency, and the compiler MUST be aware of it, even though it may look (on the surface) as a "library".

Note that the paper's author was one of the people who defined C++'s memory model for this very reason.

Re: Why I went from Python to Go (and not node.js)

#185
post #181

Earlier quoted context omitted.

I read that quote from the article as essentially self-pardoying. The author is essentially making fun of himself and the general attitude he--and other Pythonistas, I imagine--held. Then again, maybe I'm reading too much into it. For the record, I think Haskell is a strictly superior choice to Go, so I'm what he would probably call "gray-bearded" :P. (And I'm certainly working on a beard, even if it shouldn't be gra…

>maybe I'm reading too much into it. no, you got it. It's not really meant to be a criticism of Python itself, it's just behavior that is common among 20-something web developers, which is representative of some areas of the industry, and is specifically the target audience for the post. You know, the kind of developer that is advanced enough that they can build non-trivial projects, but not experienced enough to hav…

For what it's worth, the reason I prefer Haskell is exactly what you're interested in--I want to make the "best" programs. The elegance of the language is just a proxy for this.

Out of all the languages I've tried--and I've tried a decent amount--Haskell is by far the most productive. I can write my programs faster and they come out shorter, more readable, more maintainable and easier to test. I've found it far easier to go back to old Haskell code I've written than old Java or JavaScript or Perl or even Python code. All this without significantly sacrificing performance.

I've also found Haskell far easier to refactor. In most languages, my projects' code size goes up monotonically; in Haskell, it isn't rare for me to both add a feature and make the code shorter! This was a surprise the first couple of times, but now I almost expect it.

Also, critically, I've found Haskell's advantages scale superlinearly with the complexity of the problem. That is, the harder a problem is conceptually, the bigger the advantage of using Haskell over another language. Haskell actually helps me think about the problem, even if I don't want to write a program for it. I've certainly found certain tasks far easier even in other languages by thinking in Haskell terms about things like nondeterminism.

This may seem counter-intuitive, but I've even found Haskell to be very good for prototyping. Once you get used to the slightly different style of thinking it requires, the type system actually starts helping you develop solutions quickly. I'm sure other languages may be better at this than Haskell, but Haskell really shines when it's time to take your prototype and transition to a solid piece of software--it makes the refactoring much easier and makes even significant architectural changes more approachable.

The real problem is that Haskell, for whatever reason, has the rather unfair reputation of being impractical. Really nothing could be further from the truth--yes, there is plenty of theory and research in the language, but this is not there just for fun: it actually makes the language better to use, even for more mundane tasks!

You definitely don't need to understand monads to make people happy, but it certainly helps. In practice, as PHP has shown :P, you really don't need to understand much of anything to do awesome stuff. And yet we all still heavily recommend encapsulation and testing and code reuse and so on; the Haskell philosophy is just a systematic extension of this.

I think Haskell's widely spread reputation as just an academic curiosity makes some people a little defensive--and well it should! But never take it personally. It's just a little annoying for an immensely practical and productive language to be cast aside simply because it derives its efficiency from a well-founded theoretical basis.

Re: Why I went from Python to Go (and not node.js)

#186
post #177
post #150

Earlier quoted context omitted.

C is can be intimidating, C++ often is. You have to gain much experience to be able to write good C++ code. With Erlang it's simple. It's supervisiors and gen_servers all the way down.

C++ is not intimidating, it is terrifying. Erlang is nice, but has its own not-so-simple issues: http://www.youtube.com/watch?v=G0eBDWigORY Interestingly, many things in Go's design that might seem 'deficiencies' from the point of view of Erlang means most of those problems don't apply to Go at all.

That's a good talk, I've encountered these problems in the wild. Erlang isn't a silver bullet obviously and you have to know it well if you want to write something big, but it's really easy to write small to medium applications. Shame their erld isn't FOSS.

Re: Why I went from Python to Go (and not node.js)

#187
post #65

I'd like to start porting a few of my little scripts to Go (that do pretty poor messy parallelism in Python), and I was wondering what a good resource/book type thing would be for people learning Go. Like, the equivalent of learn you some haskell or whatnot. Also some advice on "wtf library do I use for this". Is there some sort of Go package manager? How does all this shit work?

I recommend starting with http://tour.golang.org/#1 . Yes, the Go tool comes with package-management capabilities. "go get labix.org/v2/mgo" will download the very excellent MongoDB driver mgo, for example.

Neat, is there something like virtualenv or rvm so I can install it locally not systemwide?

Re: Why I went from Python to Go (and not node.js)

#188

Earlier quoted context omitted.

The paper's position is that you can't implement threads, safely, as a library because the compiler is not aware of the concurrency. My point was that this reasoning may not hold if your language has full macros. Your suggestions will work great, but those are in the compiler, not as a library.

Well, the point is that concurrency primitives don't have to be built into the language to enable libraries to write safe concurrent abstractions. Rather, the type system features that enable it can exist in the compiler as general type system features unrelated to concurrency that just so happen to be able to ensure the safety of concurrent code if used properly.

I take your point, but I find it unlikely that anyone would defined the correct language semantics that would guarantee correct results under concurrency without designing for concurrency. Which is the point of Boehm's paper: your language (and its compiler) need to know about concurrency in order to get it right.

Re: Why I went from Python to Go (and not node.js)

#189
post #27

Earlier quoted context omitted.

You're digging in. > Haskell I would argue against being an industry language FYI, the problems the Haskell community has been working on are things like scalability, performance and safety because they're critical to industrial problems . Toy approaches don't work at the scale we operate at -- you need real computer science. You want 1,000,000 Haskell threads in your app? You've got it. Want to write numerical model…

> you need real computer science. Reality and PHP would disagree for 90 to 99% values of "you".

Depends where in the world you work, in Europe most IT companies only hire developers with CS degrees.

Re: Why I went from Python to Go (and not node.js)

#190

Earlier quoted context omitted.

"I've heard some firms use Ocaml." Jane Street. Would be fun to see a panel with dons and Yaron Minsky discussing the pros and cons of Haskell and Ocaml, respectively.

Actually, that would probably be pretty boring--the two languages overlap considerably. I worked at an OCaml company this summer; coming from Haskell, I picked the basics up immediately and only took a bit more time to learn some of the more advanced features (e.g. OCaml functors). I had some discussions about OCaml vs Haskell and, honestly, nobody could come up with a particularly strong case in either direction. (T…

i would really love to see ocaml versus go
Post reply on HN