design by contract versus doctest

aku aku at europe.com
Wed Apr 7 05:26:33 EDT 2004


On 2004-04-06, Colin Blackburn <colin.blackburn at durham.ac.uk> wrote:

> > Getting the require section to pass is no guarantee that the  
> > post-conditions (ensure section) will be met, the do section is code  
> > like anything else and may get things wrong.
> 
>  In correctly developed DbC that is precisely what is guaranteed. The  
>  post-condition is *guaranteed* if the pre-condition is met. 

Exactly! postcondition is guaranteed if precondition is true.
And in addition to that - and that was part of what I was trying
to say in the original post - in 
www.python.org/doc/current/lib/module-doctest.html, the 3 tests after
the line "import math" shouldn't be necessary because they should be
part of the precondition in the doc string if DBC was applied.





More information about the Python-list mailing list