News for hackers. Stuff that matters.
Re:Why I’m not leaving Python for Go by flyinRyan on Monday September 24, 2012 @07:37AM (#4564104)
>try: >> f = float(someText) >> catch ValueError: >> # I just parsed you, this is crazy, >> # here's an exception, throw it maybe?

No, you have it exactly backwards. It's with return values that you have to check after every call to be safe. With exceptions you can truly say: if I don't know what to do if this fails then I don't do anything. You can let the exception bubble up higher, all the way up to crashing the program if you like (which gives a nice stack trace that can then be debugged).

With return values, if you don't check then you could be building up more and more trash and you won't even know it until you either hit a point of code that finally does look at what's returned, or if an exception occurs (e.g. segfault).

Re:Why I’m not leaving Python for Go by Edootjuh on Monday September 24, 2012 @08:20AM (#4564234)

    try:
       f = float(someText)
    catch ValueError:
       # I just parsed you, this is crazy,
       # here's an exception, throw it maybe?
Formatted That For You
Re:Why I’m not leaving Python for Go by Evbn on Monday September 24, 2012 @11:17PM (#4568375)
"Not checking" is just shorthand for pythons " except: pass".
Re:Why I’m not leaving Python for Go by prodigal_erik on Monday September 24, 2012 @11:23PM (#4568393)
But not checking is invisible. I can't grep for it. It doesn't stand out in a code review. It's almost never what I meant to do, so it shouldn't have been the default or easily overlooked, much less both.