[Types-sig] Re: Meta-classes discussion starter
Just van Rossum
just@letterror.com
Tue, 1 Dec 1998 18:39:40 +0100
At 10:36 AM -0500 12/1/98, Donald Beaudry wrote:
>It's interesting to note that a patch is not necessary. All you need is
>an extension module that exports a hand written meta-class. This
>meta-class can then poke into the class that's being defined and check
>for the existence of the __class__ attribute.
But then you don't have the advantage which was the main reason to make
that patch, which is that you don't have to spell it like:
class A(some_extension_object):
__class__ = whatever
but that the following "just works":
class A:
__class__ = mymetahook
Or do I miss something here?
On a related note, would my hook break your stuff? The test to see whether
the method dict contains a __class__ entry happens *before* the tests that
check whether one of the base classes either has a callable type or has a
__class__ attr. If it does (break your stuff), maybe I should reverse the
tests, although that would make the hook less elegant.
Just