Live data from Hacker News

Why I’m not leaving Python for Go

uberpython.wordpress.com

11–20 of 245 posts

Re: Why I’m not leaving Python for Go

#11

I'll agree that this is perhaps the single thing that I don't like about Go. Now, you can argue it helps with "explicit error handling" and all that, but in that case you might as well have must-be-caught exceptions. Anyone want to fork Go?

"in that case you might as well have must-be-caught exceptions"

Errors aren't the same things as exceptions.

Re: Why I’m not leaving Python for Go

#12
post #5

I'll agree that this is perhaps the single thing that I don't like about Go. Now, you can argue it helps with "explicit error handling" and all that, but in that case you might as well have must-be-caught exceptions. Anyone want to fork Go?

What is it about panic/recover that forking the language , not merely using Go in a non-idiomatic way, would be necessary? I could see forking it to add generics in a way that the official guys aren't satisfied with, but why is that needed to use another style of error handling?

Because all of the rest of the ecosystem uses a different way, and switching between two different styles isn't fun.

Re: Why I’m not leaving Python for Go

#13
The author of the blog post is overlooking a major feature here. Go does multiple return types, so you can do things like this: i, err := getValue() however if you want to ignore a return variable or in this case the returned error you use an underscore like this (same as in haskell): i, _ := getValue()

This is Go's mechanism for handling (or ignoring errors) which imho is really nice because you don't have to learn anything extra, like throwing/catching error mechanisms

Re: Why I’m not leaving Python for Go

#14
post #5

Earlier quoted context omitted.

What is it about panic/recover that forking the language , not merely using Go in a non-idiomatic way, would be necessary? I could see forking it to add generics in a way that the official guys aren't satisfied with, but why is that needed to use another style of error handling?

Because all of the rest of the ecosystem uses a different way, and switching between two different styles isn't fun.

What would forking the language do to solve that? What changes would you actually make? Would it just be a matter of giving it a new name so that people didn't expect idiomatic Go things to work with it?

Are we talking about just forking its standard library and not actually changing the language?

Re: Why I’m not leaving Python for Go

#17
post #10

I suppose it's all a matter of taste. The error handling design decision is one thing I really like about Go. I write high reliability embedded software and "throw/catch" just doesn't cut it for me since it obscures possible error conditions thrown from subroutines. I want to have to explicitly deal with those errors whenever they might occur and error returns are a good way of doing that. For every language feature…

I cant follow. Throw/Catch is as powerful as a error return value but it does not let you ignore errors without writing any code.

Re: Why I’m not leaving Python for Go

#18

The author of the blog post is overlooking a major feature here. Go does multiple return types, so you can do things like this: i, err := getValue() however if you want to ignore a return variable or in this case the returned error you use an underscore like this (same as in haskell): i, _ := getValue() This is Go's mechanism for handling (or ignoring errors) which imho is really nice because you don't have to learn…

That's not the same as handling an error in a central spot automatically.

Re: Why I’m not leaving Python for Go

#19
> Verbose and repetitive error handling

If you were to handle the same error cases in Python that you gave examples for in Go, it would probably be even more verbose with the try/catch wrapped around.

> Errors passing silently – ticking time bombs to go

Are you kidding? Unless exceptions are documented well, which they rarely are, this is a much greater problem when using exceptions.

Re: Why I’m not leaving Python for Go

#20
The error handling style is certainly different - but it's not so bad. It's a matter of style and getting used to stuff.

Maybe a better error handling mechanism is needed - but I'd prefer if it's not exception handling. Perhaps lisp style error handling? What ever that is - for I'm not familiar with it - but I keep hearing lispers brag about how awesome it is!

Post reply on HN