status of Programming by Contract (PEP 316)?

Russ uymqlp502 at sneakemail.com
Fri Aug 31 01:38:49 EDT 2007


> I guess one difference from unit test philosophy is > that at least
> sometime, you'd run the entire application with all > the dbc checks
> enabled, and just live with the slowdown.

Yes, that's right. You don't expect to run efficiently with the self-
test checks activated, but you can test your code more conveniently
and comprehensively than unit tests by simply running your program as
usual -- except with the checks activated. If you do that for any
significant period of time, many bugs will find themselves, I'm sure.

Also, to repeat once again, the embedded self-test (DbC) checks can be
used for unit testing too. You simply activate the self-tests when you
do your unit testing, and wait for them to throw exceptions. So it
seems to me that you've killed two birds with one stone.




More information about the Python-list mailing list