question: metaclass and C - a new general style
Greg Chapman
glchapman at earthlink.net
Tue Nov 27 14:41:30 EST 2001
On 26 Nov 2001 13:23:17 +0200, Jens Gelhaar <cuiod-tec at web.de> wrote:
>I am working serveral years with Python, but I am new to the C stuff. I need an
>hint, to change the source code to get the following behaviour:
> When I compile a module with an class in it, I would like to call a special
>function: __metainit__ after the class has been compiled. The calling parameters
>should the be the class itself and the enviroment one step up.
Rather than changing the source code, I recommend looking at test_descr.py in
the 2.2 beta. The __new__ method of the various metaclasses demonstrated there
seems to me to be essentially what you are calling __metainit__. At any rate,
it looks like it should be possible to use a metaclass __new__ (or __init__ for
that matter) to accomplish what you described.
---
Greg Chapman
More information about the Python-list
mailing list