Order in metaclass

Michele Simionato michele.simionato at gmail.com
Fri Oct 15 00:37:10 EDT 2004


Carlos Ribeiro <carribeiro at gmail.com> wrote in message news:<mailman.4957.1097770559.5135.python-list at python.org>...
> On Thu, 14 Oct 2004 14:51:52 GMT, Michael Hudson <mwh at python.net> wrote:
> > bokr at oz.net (Bengt Richter) writes:
> > 
> > > IIRC it was Guido himself who let the cat out of the bag about a
> > > function, in some early metaclass notes. But maybe I don't RC ;-)
> > 
> > I don't get the fuss about a function vs a class for the value of
> > __metaclass__.  It's a callable.  It gets called.  No mystery *here*
> > :)
> 
> I think it has something to do with the intended working of
> metaclasses. After all, they're called meta_classes_, not
> metafunctions :-) But on a more serious note: in other languages, such
> as Smalltalk, metaclasses are a standard part of the language, and are
> _classes_. There is a _metaclass hierarchy_, superimposed to the class
> hierarchy. Metaclasses are supposed to be classes because they can be
> inherited from, for example. And I believe that was only by accident,
> and not by a explicit design choice, that Python's implementation
> accepts any callable as a metaclass.

Using a "metafunction" is a kind of abuse, yes. Nevertheless, I used this trick
to resolve the metaclass conflict:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204197c

Later on, I also found a way to avoid the usage of the meta-function,
but it was too brain-exploder to publish ;-)

           Michele Simionato



More information about the Python-list mailing list