3 ms·
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
by barrkel 14y ago
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.
- TylerE 14y agoSo 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'