Re:Why Go Gets Exceptions Right
by barrkel on Friday September 14, 2012 @09:42AM
(#4521556)
No library in a language with exceptions as they're normally used would do that. Exceptions are for exceptional cases. You use the method that throws only if it is a programming error for it to throw; and you do not, as a general rule, catch exceptions. See eg Dictionary.TryGetValue in .net. Your argument is against a straw man, IMHO.
[ Parent
| on HN ]
So are you saying python is not a sane language?
>>> a = {}
>>> a['foo']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'foo'Python uses Exceptions for unexceptional cases, yes, like loop termination. It's one of the only languages to do it.