[Python-ideas] Pre-conditions and post-conditions

Steven D'Aprano steve at pearwood.info
Mon Aug 27 06:35:06 EDT 2018


On Mon, Aug 27, 2018 at 09:24:20AM +0100, Ivan Levkivskyi wrote:
> TBH, I think one of the main points of design by contract is that contracts
> are verified statically.

No, that's not correct. Contracts may be verified statically if the 
compiler is able to do so, but they are considered runtime checks. 
Static checks are an optimization.

For example, the Eiffel docs describe one possible contract as "the 
graph contains no cycle" and can contain function calls.

https://www.eiffel.org/doc/eiffel/ET-_Design_by_Contract_%28tm%29%2C_Assertions_and_Exceptions



-- 
Steven


More information about the Python-ideas mailing list