2011年7月15日金曜日

python:TypeError 継承した親クラスの__init__ 

まずはこーんなエラー
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)


from module import name1,name2
とするか
module.name1()
として呼び出せとのこと。
pythonで継承(TypeError?)

次にこんな感じのエラー
TypeError: unbound method __init__() must be called with ChilidClass instance as first argument (got ParentClass instance instead)
こんな感じでいいみたい
class ParentClass:
    def __init__(self):
        pass

class ChildClass(ParentClass):
    def __init__(self):
    ParentClass.__init__(self, param)


じゃ、そういうことで。

0 件のコメント:

コメントを投稿