The creation of a class via declaration of the form
class Simple(Base):
x=0
is equivalent, I believe, to using a type statement:
Simple = type( 'Simple', (Base,), dict( x=0 ) )
Is there a type statement equivalent to the following declaration?
class Simple(Base,metaclass=Meta):
x=0
def __init__(self,x):
self.x = x
I've tried
def s2_init(self,x):
self.x = x
S2 = type( 'Simple', (Base,), dict( x=0, __metaclass__=Meta , __init__=s2_init) )
but Meta does not get used when S2 is instantiated (this behaviour, __metaclass__ being ignored, is as expected from the documentation).