metaclass and customization with parameters

Carlos Ribeiro carribeiro at gmail.com
Mon Oct 4 01:07:09 CEST 2004


On Mon, 4 Oct 2004 00:41:04 +0200, Alex Martelli <aleaxit at yahoo.com> wrote:
> Carlos Ribeiro <carribeiro at gmail.com> wrote:
>    ...
> Mostly interesting comments, snipped but hopefully useful to clear up
> some confusions from readers, but one I need to comment on...:
> 
> > languages. That happens because def's are not executed at this time -
> > def's are only compiled. But any code inside a class definition that
> 
> Each def statement IS indeed executed; I think what you mean to say is
> that a def statement does not execute the body of the function it's
> defining, it just stashes that body away (in a compiled form) for future
> execution (each time that function is called).

Correct. Thanks for pointing out the difference between the def
statement (which is executed) and the body of the function. This
difference is really important, and once you *really* understand it --
as far as classes, functions and modules declarations work at runtime
-- everything just fits in perfectly.

BTW, once I finish my deep imersion into new style classes, which
includes metaclasses and descriptors, I intend to write a tutorial and
post it somewhere. It's a fascinating topic, but the documentation
seems to assume that you already know what is this stuff useful for
:-) A tutorial would help to clarify stuff greatly.
-- 
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