I am trying to call a parent's __init__ method from the child's:
class ArbitraryBlock( InnerBlock):
def __init__(self, codelist, noout=False, **kwargs):
InnerBlock.__in it__(self, codelist, noout=noout, **kwargs)
I get this error:
<type 'exceptions.Typ eError'>: unbound method __init__() must be
called with InnerBlock instance as first argument (got ArbitraryBlock
instance instead)
I found a thread that talked about the parent and child being
different types, so I tried setting up the parent class 3 different
ways:
class InnerBlock:
class InnerBlock(obje ct):
class InnerBlock(empt y_class):
where
class empty_class(obj ect):
def __init__(self,_ d={},**kwargs):
kwargs.update(_ d)
self.__dict__=k wargs
I still get the same error. Why doesn't this work?
Thanks,
Ryan
class ArbitraryBlock( InnerBlock):
def __init__(self, codelist, noout=False, **kwargs):
InnerBlock.__in it__(self, codelist, noout=noout, **kwargs)
I get this error:
<type 'exceptions.Typ eError'>: unbound method __init__() must be
called with InnerBlock instance as first argument (got ArbitraryBlock
instance instead)
I found a thread that talked about the parent and child being
different types, so I tried setting up the parent class 3 different
ways:
class InnerBlock:
class InnerBlock(obje ct):
class InnerBlock(empt y_class):
where
class empty_class(obj ect):
def __init__(self,_ d={},**kwargs):
kwargs.update(_ d)
self.__dict__=k wargs
I still get the same error. Why doesn't this work?
Thanks,
Ryan
Comment