Python super


Пример использования функции super

В python 2

class A(object):
    def __init__(self, name):
        self.name = name

class B(A):
    def __init__(*args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)
        .....
        some code here

В python 3

class A(object):
    def __init__(self, name):
        self.name = name

class A(B):
    def __init__(*args, **kwargs):
        super().__init__(*args, **kwargs)
        .....
        some code here