Exception as the primary error handling mechanism?

r0g aioe.org at technicalbloke.com
Tue Jan 5 20:03:12 EST 2010


Lie Ryan wrote:
> On 1/6/2010 1:48 AM, r0g wrote:
>> Steven D'Aprano wrote:
>>> On Tue, 05 Jan 2010 13:06:20 +0000, r0g wrote:
>>>> If
>>>> that's the case how can you expect it to validate anything at all in
>>>> production?
>>>
>>> The asserts still operate so long as you don't use the -O switch.
>>>
<snip>
> checking, since the function relies on the caller obeying the
> contract[2] and never calling it with an invalid input.
> 
> DbC uses assertions[1] spuriously, unlike the traditional approach which
> is much more conservative when using assertions.
> 
> [1] or explicit language support which is just syntax sugar for assertions
> [2] of course, on a debug release, the contract validation code will
> still be enforced to catch logic/consistency bugs that causes the violation


Thanks for the responses Steven/Dave/Lie, that's some really insightful
stuff :)

Roger.



More information about the Python-list mailing list