Programming by Contract in Python
23rd May 2003
Programming by Contract seems to be a sister technique to unit testing—instead of (or as well as) writing a set of tests for a piece of code you write a set of pre- and post-conditions for the data being processed which are then checked whenever the program is run in debugging mode. Contracts for Python discusses the technique, providing a reference implementation and a PEP suggesting inclusion of support for the technique in the core language. Programming by contract was first demonstrated in the Eiffel language, and there’s a good introduction to it in Eiffel.com as well.
More recent articles
- AI assisted search-based research actually works now - 21st April 2025
- Maybe Meta's Llama claims to be open source because of the EU AI act - 19th April 2025
- Image segmentation using Gemini 2.5 - 18th April 2025