On 5 September 2013 14:48, Ben Finney <[email protected]> wrote:

> Why is it a problem for the exception to be raised within the bowels of
> your program? I'm not saying there can't be a reason, but you haven't
> said what the problem is.
>

The earlier you catch the error, the faster you can debug the source
problem and fix it.

Have had many cases where an error in a parameter to a function doesn't
show up until sometime later after the function has returned, making it
very hard to find out what the error was.

Worse still, there are some errors that will just give incorrect results
without giving an error.

Much easier to catch the errors as soon as possible.

Having asserts through your code also helps document the assumptions you
made when you wrote it, which in turn makes it easier to understand the
code.
-- 
Brian May <[email protected]>
_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to