[Python-Dev] type categories

David Abrahams David Abrahams" <dave@boost-consulting.com
Thu, 12 Sep 2002 21:26:38 -0400

From: "Aahz" <aahz@pythoncraft.com>

> On Sat, Aug 24, 2002, Guido van Rossum wrote:
> >
> > Why do keep arguing for inheritance?  (a) the need to deny inheritance
> > from an interface, while essential, is relatively rare IMO, and in
> > *most* cases the inheritance rules work just fine; (b) having two
> > separate but similar mechanisms makes the language larger.
> >
> > For example, if we ever are going to add argument type declarations to
> > Python, it will probably look like this:
> >
> >     def foo(a: classA, b: classB):
> >         ...body...
> I'm curious, and I don't recall having seen anything about this: why
> wouldn't we simply use attributes to hold this information, like
> __slots__?  After all, attributes get inherited, too, and there's no
> need to pretzel the syntax.  Using attributes IMO would make it easier
> to handle the case where derived classes need to mangle type and
> interface declarations.

A few weeks ago I realized there was reason in principle that declaring a
class satisfies an interface shouldn't just amount to adding the interface
to the class' __bases__ (as Guido has been suggesting all along).

Why not? Am we missing somethings?


           David Abrahams * Boost Consulting
dave@boost-consulting.com * http://www.boost-consulting.com