Design by Contract for Python

Michael Chermside mcherm at mcherm.com
Wed May 14 12:47:15 EDT 2003


Terence:

First of all, good work! I agree that direct support for DBC in the
Python language would be a good thing, and I agree that the way to
go about it is rather like the way unit testing got in there... to
have a single (unit testing had 2, which was too many) standard 
implementation which is easy to use and then becomes widely used,
and is then acknowledged as the standard and accepted into the core.

However, I'm not sure that what you describe in your draft PEP is 
quite the way to go. In particular, I am very wary of stuffing code 
into doc comments. I think of preconditions, postconditions, and 
invariants as bits of code, which should be syntax checked just like
any other, and colorized by the editor just like any other, they're
just not EXECUTED like any other (ie, not at all in production mode).

So I guess I'd prefer Daniel Arbuckle's approach to the use of doc
comments.

-- Michael Chermside






More information about the Python-list mailing list