Order in metaclass

Carlos Ribeiro carribeiro at gmail.com
Thu Oct 14 12:15:57 EDT 2004


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.

-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list