ANN: Design By Contract for Python 1.0 beta 1
Cristian Tibirna
tibirna at kde.org
Thu May 22 19:14:25 EDT 2003
On Thursday, 22 May 2003 00:45, Terence Way wrote to comp.lang.python:
> Announcing Design By Contract for Python 1.0 beta 1
>
> Design by Contract is familiar to anyone who has spent time with the
> Eiffel programming language. This implementation is a cross between
> full Eiffel-style contracts and the doctest module.
>
> Contracts are high-level assertions that are part of the program's
> documentation. Modules and classes have invariants, expressions that
> must be true at the start and end of every public function or method
> call. Methods and functions have pre-conditions, expressions that must
> be true on entry; and post-conditions, expressions that must be true
WOW! VERY interesting! Thanks a lot for this. We use contract programming
thanks to a clever design based on preprocessor macros and C++ features, in
our rather largish finite element library (at work, not in KDE).
Now, one of the greatest features of contract programming is the ability to
disable it :-) No, this is not a joke. Checkings are very important, but
once a program has been written, we deactivate the preconditions and
postconditions. Of course, this required us to provide a different
mechanism for trapping end-user data input errors (we use some sort of
custom exceptions, based on message passing to-from methods/functions).
Thus, question. Is this (deactivation) a planned feature for your wonderful
tool?
--
Cristian Tibirna
KDE developer .. tibirna at kde.org .. http://www.kde.org
More information about the Python-list
mailing list