且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Python中的子类调用父类的方法?

更新时间:2023-12-05 15:18:52

是,但只能使用新式类别。使用 super() function:

Yes, but only with new-style classes. Use the super() function:

class Foo(Bar):
    def baz(self, arg):
        return super(Foo, self).baz(arg)