[Python-ideas] Why is design-by-contracts not widely adopted?

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 28 20:30:45 EDT 2018


Chris Angelico wrote:
> But as a part of the
> function's declared intent, it's fine to have a postcondition of "the
> directory will be empty" even though something could drop a file into
> it.

If you only intend the contract to serve as documentation,
I suppose that's okay, but it means you can't turn on runtime
checking of contracts, otherwise your program could suffer
spurious failures.

-- 
Greg


More information about the Python-ideas mailing list