Re: Classes with initialization

2007-04-09 Thread Carl Banks
On Apr 9, 3:26 am, [EMAIL PROTECTED] wrote: > Hi all, > > I'm currently using code similar to this: > > class ClassWithInitialization(type): > def __init__(cls, name, bases, dict): > type.__init__(name, bases, dict) > dict['__class_init__'](cls) > > class A: > __

Re: Classes with initialization

2007-04-09 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > > Also: can someone enlighten me as to when code in class scope is run, > > exactly? It's run as a part of the execution of the class statement. > > if a class A has a metaclass M, then M.__init__ does not seem to get > > the code in A's class scope in its argu

Re: Classes with initialization

2007-04-09 Thread Michele Simionato
On Apr 9, 9:26 am, [EMAIL PROTECTED] wrote: > Hi all, > > I'm currently using code similar to this: > > class ClassWithInitialization(type): > def __init__(cls, name, bases, dict): > type.__init__(name, bases, dict) > dict['__class_init__'](cls) > > class A: > __

Re: Classes with initialization

2007-04-09 Thread kyosohma
On Apr 9, 2:26 am, [EMAIL PROTECTED] wrote: > Hi all, > > I'm currently using code similar to this: > > class ClassWithInitialization(type): > def __init__(cls, name, bases, dict): > type.__init__(name, bases, dict) > dict['__class_init__'](cls) > > class A: > __

Classes with initialization

2007-04-09 Thread mariano . suarezalvarez
Hi all, I'm currently using code similar to this: class ClassWithInitialization(type): def __init__(cls, name, bases, dict): type.__init__(name, bases, dict) dict['__class_init__'](cls) class A: __metaclass__ = ClassWithInitialization def __class_init__