On Sun, Sep 30, 2018, 15:12 Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> Steven D'Aprano writes: > > > (4) Inheritance > > > > Contracts are inherited, unit tests are not. > > What does "inherited" mean? Just that methods that are not overridden > retain their contracts? > Contracts are attached to interfaces, not to specifications. So when you have abstract base class, it defines contracts, and implementing classes must adhere to these contracts - the can only strengthen it, not weaken it. This way the user code need pnly be aware of the specification, not the implementation. So method that _are_ overridden retain their contracts. This is precisely like with types, since types are contracts (and vice versa, in a way). Elazar
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/