design by contract versus doctest

Peter Hansen peter at engcorp.com
Tue Apr 6 06:51:16 EDT 2004


Yermat wrote:

> Peter Hansen wrote:
>> But I'm certainly no expert in (or proponent of) DBC...
> 
> see http://www.python.org/doc/essays/metaclasses/Eiffel.py
> to now how to do (at least one way to) design by contract in Python.

This doesn't appear to do what the OP says it should do.
I see preconditions which, while coded in separate methods
from the code for which it is written, still executes
every time the method is called.  That is, in terms of the
sequence of code, it's the same as just putting the check
in at the top of the called method.

-Peter



More information about the Python-list mailing list