[Types-sig] Re: Meta-classes discussion starter
Donald Beaudry
Donald Beaudry <donb@tensilica.com>
Tue, 01 Dec 1998 10:27:44 -0500
Just van Rossum <just@letterror.com> wrote,
> While digging in ceval.c and understanding how the Don Beaudry and
> Guido's own hook actually work I came up with mine, which I define thusly:
>
> If the __dict__ of the class that is being built has a __class__
> key, call that thing with (name, bases, methods)
>
> Which means you specify a metaclass like this:
>
> class MyClass:
> __class__ = MyMetaClass
>
> Not exactly pretty, but at least it doesn't look like inheritance. It also
> means that if you want to subclass from MyMetaClass you write
Fantastic! Just, you're a genius! ...and coming from a raving
lunatic, that might mean something, like you too are a raving lunatic.
That's exactly what I proposed a while back, but with a twist. You
might be interested in talking a look at my objectmodule extension.
The twist is what you just proposed is allowed, you can then nest your
meta-class definition inside the class that needs it. I just posted
an example of that in my last message to this sig.
--Don