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

Chris Angelico rosuav at gmail.com
Tue Sep 25 16:39:05 EDT 2018

On Wed, Sep 26, 2018 at 6:09 AM Lee Braiden <leebraid at gmail.com> wrote:
> Eh. It's too easy to cry "show me the facts" in any argument.  To do that too often is to reduce all discussion to pendantry.
> That verifying data against the contract a function makes code more reliable should be self evident to anyone with even the most rudimentary understanding of a function call, let alone a library or large application.  It's the reason why type checking exists, and why bounds checking exists, and why unit checking exists too.

It's easy, but it's also often correct.

>From my reading of this thread, there HAS been evidence given that DbC
can be beneficial in some cases. I do not believe there has been
evidence enough to cite the number of projects on PyPI as "this is how
many projects would benefit".

Part of the trouble is finding a concise syntax for the contracts that
is still sufficiently expressive.


More information about the Python-ideas mailing list