[Types-sig] Why have two hierarchies?

Niels Ferguson vorpal@xs4all.nl
Thu, 03 Dec 1998 22:22:34 +0100


I have been trying to follow the meta-class discussion (with varying
success), so it is quite possible that my comments are due to my limited
understanding of the subject.

I find the idea of having a meta-class hierarchy and a separate class
derivation hierarchy confusing. My question is whether you cannot merge the
two into a single framework.

The idea is to make the meta-class the first class in the list of
parent-classes. To allow the meta-class functions to do their work, all we
need to do is to provide access to the list of the rest of the subclasses
in some way. This gives the meta-class the first chance to intercept any
method access, and implement any behaviour that it likes. In particular, it
can control how the behaviour of the class depends on the subclasses. 

I don't have the overview over the Python internals to know how this would
have to be implemented. It requires some form of a generalised __getitem__
mechanism. However, this seems simpler (particularly in definition) than
introducing a second hierarchy.

Niels



============================================================
Niels Ferguson, vorpal@xs4all.nl, voice/fax: +31 20 463 0977
PGP: 50E0 CBE2 3F19 C17D  FBE3 FFA5 38B7 BBB5