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

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Sat Sep 29 11:15:39 EDT 2018


Steven D'Aprano writes:

 > I just wish we didn't have to fight so hard to justify the very
 > idea of contracts themselves.

You don't.  You need to justify putting them in the stdlib.  That's a
pretty high bar.  And as crappy as the contracts in Marko's pathlib
rewrite look to me, I suspect you'll need syntactic support (eg, for
"implies", see my post replying to Marko).  If people want checking in
production where reasonable (seems to be one of the nice things about
contracts), you'll probably want a language change to support that
syntax efficiently, which is usually a prohibitively high bar.



More information about the Python-ideas mailing list