def initialize_bases(obj):
    """Initialize base classes with own __init__ method.

    ### parameters

    obj (custom class instance)
        an instance whose class inherits from other classes
        which may have or not their own constructors.

    ### discussion

    Iterates over the bases classes of obj, initializing
    those which have their own constructor method (__init__).

    It is meant to be used inside the __init__ method of
    a class which inherits from other classes which you'll
    want to initialize (execute the __init__ method) if
    they have their own __init__ method.

    ### doctests

    >>> class A:
    ...     def __init__(self):
    ...         self.name = "a name"
    >>> class B:
    ...     def __init__(self):
    ...         self.age = 23
    >>> class C: pass
    >>> class D(A, B, C):
    ...     def __init__(self):
    ...         initialize_bases(self)
    >>> obj = D()
    >>> obj.name, obj.age
    ('a name', 23)
    """
    ### iterate over base classes (superclasses)

    for class_ in obj.__class__.__bases__:

        ## if the class has its own __init__ method,
        ## execute it passing the obj instance to it

        if has_own_init(class_):
            class_.__init__(obj)
Initialize base classes with own __init__ method.

    ### parameters

    obj (custom class instance)
        an instance whose class inherits from other classes
        which may have or not their own constructors.

    ### discussion

    Iterates over the bases classes of obj, initializing
    those which have their own constructor method (__init__).

    It is meant to be used inside the __init__ method of
    a class which inherits from other classes which you'll
    want to initialize (execute the __init__ method) if
    they have their own __init__ method.

    ### doctests

    >>> class A:
    ...     def __init__(self):
    ...         self.name = "a name"
    >>> class B:
    ...     def __init__(self):
    ...         self.age = 23
    >>> class C: pass
    >>> class D(A, B, C):
    ...     def __init__(self):
    ...         initialize_bases(self)
    >>> obj = D()
    >>> obj.name, obj.age
    ('a name', 23)
    
nodezator/ourstdlibs/meta.py