Metaclass with name overloading.

Carlos Ribeiro carribeiro at gmail.com
Mon Sep 27 11:21:54 EDT 2004


On Mon, 27 Sep 2004 16:47:31 +0200, Alex Martelli <aleaxit at yahoo.com> wrote:
> I'm confused as to why you would assume that and what you mean by
> 'declaration'.  I'll take it that you mean the _execution_ of the class
> _statement_, in which case I really can't see how you could assume any
> such thing.  You _do_ know that __metaclass__ can be set anywhere in the
> class body, for example, right?  So how could Python know the metaclass
> before it's done executing the class body?  Yet it's exactly in order to
> execute the class body in the modified way you desire, that Python would
> need to set a certain frame's f_locals differently from the usual dict.

Forgive me, because I've made a big confusion. For some reason, I
assumed that the __metaclass__ statement had to be the first one on
the class declaration. I don't know why. Probably because all examples
that I have seen so far have were done like that, and in a way, it
made sense to me -- probably because I wanted it to be that.

I think that I'm trying to do too many thing at once, with more
enthusiasm than solid knowledge. I really feel that I'm on the right
path, but I'm still missing a lot of stuff. I'll try to rest a little,
think carefully about all the ideas that have popped in my mind over
the past week, and try to study it a little better *before* trying to
post again. Real thanks for all the help.

-- 
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