0

Why print(b.__dict__) prints{'state': 'Init'} I understand, but why does print(b._di) print{'state': 'Init'}?

class A:
    _di = {}
    
    def __init__(self):
        self.__dict__ = self._di


class B(A):
    def __init__(self):
        super().__init__()
        self.state = "Init"


b = B()
print(b.__dict__) # {'state': 'Init'}
print(b._di) # {'state': 'Init'}
Anne Maier
  • 299
  • 1
  • 8

0 Answers0