Hacker News new | ask | show | jobs
by Bnshsysjab 2113 days ago
I’ve recently tried to pickup Go having coded python since 2007.

I find the ideologies behind the language awkward, particularly explicit error object returns, but ultimately I feel upset with what boils down to ‘it’s not python’

Am I destined to hate Go? Some python limitations get to me, namely multiprocessor support and dynamically types fuzziness (typehint sugar is nice but I’d like my compiler to explicitly fail thanks).

3 comments

Nim has a python-ish feel, though it's definitely not python. The syntax is similar, the semantics are different -- but are very sane. It's much less opinionated than Python or Go, about as fun to write as Python, about as easy to deploy as Go (simple small native executables without dependencies), and about as fast to run and FFI as C++ (if you use the native backends, but it also has JS backend)

Try it, you might like it.

Can you elaborate a bit more on what bothers you about Go? “It’s not Python” could encompass a lot of things.

Personally, I use both languages (as well as Java and C#) and find they do really well for different tasks. If I need a binary command-line tool that I can ship off fairly easily I turn to Go. If I need to quickly parse some text files, bang out a quick HTTP client script, or automate some AWS tasks, I’ll go with Python.

It's been a while since I last touched go. But I remember having a bunch of fun with it when coding up some mathematical challenge problems.

Off hand here's what I remember:

Any two integers can be calculated in python without issue. In C/C++ and golang, you have to check for overflow somehow.

So when python decodes a json, any large integer get parsed correctly and put into memory. With golang and C/C++, those are extra corner cases.

panic() seems to be half-hearted. Kind of like C++'s attempt to use exceptions. Not completely unhelpful, but not a big productivity win. But in either language, the stack has to unwind -- so it feels like they could have used exceptions, and golang errors can be a class with it's own type...

Index out of bounds in arrays panic, in python it's just an IndexError.

Channels block, and trying to work around that is weirdish. It's akin to unix file descriptors, but I can ask unix if the file descriptor would block before I use it. What's wrong with:

    ok, err = ch.send("message", timeout=5)
Non-blocking would just be:

    ok, err = ch.send("message", timeout=0)
I decided not to move to go, in the end. While yes, go would be faster, many of the things I'd use on a day to day basis wouldn't change. Databases, network speed, file/disk access, etc.
Error handling in Go seems obnoxious to me, but I haven't spent any time with the language. You might want to give Elixir a shot: don't bother handling errors at all!

(Ok, that's more than a bit of an exaggeration, but relative to Go there's a lot of truth to it.)