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

Chris Angelico rosuav at gmail.com
Wed Sep 26 20:08:56 EDT 2018

On Thu, Sep 27, 2018 at 10:07 AM Robert Collins
<robertc at robertcollins.net> wrote:
> On 27 September 2018 at 11:50, Chris Angelico <rosuav at gmail.com> wrote:
> > Okay, but what is the contract that's being violated when you use
> > data= ? How would you define the contract that this would track?
> > That's what I'm asking.
> I don't know :). From a modelling perspective the correctness of the
> behaviour here depends on state in the server :/.

Exactly. It's the same problem as with trying to write contracts for
matplotlib's plt.show() - its job is fundamentally external, so you
can't define preconditions and postconditions for it. This is one of
the limitations of contracts, or at least that's my understanding.
Maybe I can be proven wrong here?


More information about the Python-ideas mailing list