无法在Python中初始化对象

尝试初始化子类的对象时出现错误。您能帮我解决此错误吗?

基类

 Class B(Object):
    def __init__(self, builder):
        self.test = builder.test
    #using builder pattern here
    class Builder:
        test = None

        @classmethod
        def set_test(cls, value):
            cls.test = value

        @classmethod
        def build(cls):
            return B(cls)


#main class       
Class A(B):
   super(A, self).__init__()


Obj = A(B.Builder.set_test().build())

错误:TypeError:new()恰好接受4个参数(给定2个)

评论