Verifying assertion failures

Courageous jkraska1 at san.rr.com
Sat May 19 14:08:50 EDT 2001


>Can you give an example where you'd want to do that, rather than throw
>an exception more pertinent to the failure?  I thought the point of
>assertions was to halt the program when one of the assumptions your code
>is relying on proves to be false.

Assertions don't have points; the programmers who use them do.
Which is to say, whether or not catching some kind of assertion failure
is appropriate is up to the programmer in question. As to your question
about throwing a specific exception, that seems the right answer to me.

This is, of course, all very independent of the question as to whether
or not assert/catch ought to be a form in Python. Personally, I don't think
so.

C//




More information about the Python-list mailing list