This submission describes programming by contract for Python. Eiffel's Design By Contract(tm) is perhaps the most popular use of programming contracts [2].
Programming contracts extends the language to include invariant expressions for classes and modules, and pre- and post-condition expressions for functions and methods.
These expressions (contracts) are similar to assertions: they must be true or the program is stopped, and run-time checking of the contracts is typically only enabled while debugging. Contracts are higher-level than straight assertions and are typically included in documentation.
Comments
-
2010/06/18 10:00, written by aleufroy
| reply to this comment
(add comment)Ben jutement, j'ai vu hier que tritium utilisait un module python pour ça:
http://pypi.python.org/pypi/contract