[Python-Dev] Class Methods
Just van Rossum
just at letterror.com
Sun Apr 22 14:26:31 EDT 2001
"Barry A. Warsaw" wrote:
> Another question: presumably when I write
>
> class Foo: pass
>
> Foo is implicitly given the built-in metaclass M, but say I wanted to
> define a class Foo with a different metaclass, how would I spell this?
> I think at one point I suggested a semi-ugly syntactic hack, where
> `class' was actually a namespace and you could add new metaclasses to
> it. So you could write something like
>
> class.WeirdClass Foo: pass
>
> and now Foo's metaclass would be WeirdClass.
I once proposed (and implemented as an extension to the metaclass hook)
this:
class Foo:
__class__ = WeirdClass
I still don't think that's all that bad, especially since it screams
magic at you...
Just
More information about the Python-list
mailing list