101 reputation
bio website ampsoft.net
location Spain
visits member for 3 years, 1 month
seen May 15 '12 at 16:49

comment Defensive Programming vs Exception Handling?
+1. I like the idea of exception handling, but I try to use error checking as the first option, not only for avoiding "exception laziness" (using try..catch as a replacement for a better program logic), but also because it avoids some dangerous bugs: e.g. at my workplace the function (not python) that queries the DB returns false (no exception) when the SQL query fails, and if you try to you use an uninitialized result set it throws an exception, but maybe you have it "initialized" of previous use (e.g. when it fails in the middle of a loop), so instead of failing you are using the wrong data.
awarded  Supporter