[Python-Dev] type categories
Mon, 26 Aug 2002 00:57:30 -0700 (PDT)
On Fri, 23 Aug 2002, Guido van Rossum wrote:
> I haven't given up the hope that inheritance and interfaces could use
> the same mechanisms. But Jim Fulton, based on years of experience in
> Zope, claims they really should be different. I wish I understood why
> he thinks so.
If i may hazard a guess, i'd imagine that Jim's answer would simply be
that inheritance (of implementation) doesn't imply subtyping, and
subtyping doesn't imply inheritance.
That is, you may often want to re-use the implementation of one class
in another class, but this doesn't mean the new class will meet all of
the commitments of the old. Conversely, you may often want to declare
that different classes adhere to the same set of commitments (i.e.
provide the same interface) even if they have different implementations.
(A common situation where the latter occurs is when the implementations
are written by different people.)
> Agreeing on an ontology seems the hardest part to me.
Indeed. One of the advantages of separating inheritance and subtyping
is that this can give you a bit more flexibility in setting up the
ontology, which may make it easier to settle on something good.