3 ms·
Ah, this leads to some of my favourite python bugs. Silent failures because you are catching and ignoring an error in some higher calling function where the err
by hyperion2010 11y ago
Ah, this leads to some of my favourite python bugs. Silent failures because you are catching and ignoring an error in some higher calling function where the error type that was once designed to deal with a single case is now overly broad. I've almost given up using try/catch for KeyErrors as a result.
- pekk 11y agoPython uses try/except, not try/catch. The only reason to catch KeyError is to detect missing keys, so if you are trying to do that, only wrap your dict access rather than wrapping large blocks of code where anything could happen. If you are writing code to ignore errors, that is a bug in your own code, not a python bug.
- hyperion2010 11y agoYes. s/python bugs/bugs in my python code