[Python-Dev] Classes and Metaclasses in Smalltalk
M.-A. Lemburg
mal@lemburg.com
Fri, 04 May 2001 10:40:17 +0200
Greg Ewing wrote:
>
> "M.-A. Lemburg" <mal@lemburg.com>:
>
> > I think it has to do with terminology: when I say "inherit"
> > I actually mean "the lookup is forwarded to the another object".
>
> Some OO languages munge together the instance and inheritance
> relationships, but Python isn't one of them. Using terminology
> that way in the context of Python is guaranteed to cause
> massive confusion!
But that's exactly what I am trying to do here: separate the
notion of how lookups work (inheritance) from how objects are
created (instantiation) !
In Python instantiation binds the new object to the creating
class and all failing lookups are directed from the object to
the class.
OTOH, the class - base-class lookup relationship
doesn't have anything to do creation of objects -- classes
are simply bound to their base-classes per definition of the
class in the sense that failing lookups are directed to the
base-classes.
Classes themselves are created by meta-classes. The lookup
strategy between the two is defined by the meta-class.
What I'm argueing for is that meta-classes should get complete
control over how lookups and object creation are done. However,
this will only be possible by breaking the current automatic
lookup scheme at the meta-class - class boundary since otherwise
you'd run into endless loops during lookups (e.g. for many of
the __xxx__ methods).
--
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/