[Solved] Dictionary in a child class to update the dictionary with same name defined in parent class instead of over-riding


Found this based on some of the ideas around:

class B(A):
_d = {}

def __init__(self):
    for parent_klass in inspect.getmro(self.__class__):
        _d.update(getattr(parent_klass, 'd', {}))
    _d.update(self.d)
    self.d = _d

solved Dictionary in a child class to update the dictionary with same name defined in parent class instead of over-riding