[Python-Dev] type categories
Guido van Rossum
Mon, 26 Aug 2002 11:31:34 -0400
> > [Ping]
> > > 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.
> > Well, yes, of course. But I strongly believe that in *most* cases,
> > inheritance and subtyping go hand in hand. I'd rather invent a
> > mechanism to deal with the exceptions rather than invent two parallel
> > mechanisms that must both be deployed separately to get the full
> > benefit out of them.
> One exception being to able to declare conformance to an interface
> after-the-fact in some sweet way.
I've heard of people who add mix-in base classes after the fact by
using assignment to __bases__. (This is currently not supported by
new-style classes, but it's on my list of things to fix.)
If that's not acceptable (it certainly looks questionable to me :-), I
guess a separate registry may have to be created; ditto for deviations
in the other direction (implementation inheritance without interface
> my ideas of declaring partial conformance and of super-interfaces
> identified as a base-interface plus a subset of signatures do not
> fit so well in a just-abstract-classes model. But OTOH I insist,
> IMO, given how python code is written now, they would be handy
> although complex.
Yes, I'll have to think about that idea some more. It's appealing
because it matches current Pythonic practice better than anything
OTOH I want a solution that can be verified at compile time.
--Guido van Rossum (home page: http://www.python.org/~guido/)