fork download
  1. class A:
  2. def __init__(self):
  3. self.a = 1
  4. self.b = 2
  5. self.c = 3
  6.  
  7. def __repr__(self):
  8. return 'a = {}\nb = {}\nc = {}'.format(self.a, self.b, self.c)
  9.  
  10.  
  11. class B(A):
  12. def __init__(self):
  13. # A.__init__(self)
  14. super().__init__()
  15. self.d = 4
  16. self.e = 5
  17.  
  18. def __repr__(self):
  19. return 'a = {}\nb = {}\nc = {}\nd = {}\ne = {}'.format(self.a, self.b, self.c, self.d, self.e)
  20.  
  21.  
  22. if __name__ == "__main__":
  23. x = A()
  24. y = B()
  25. print(repr(x))
  26. print()
  27. print(repr(y))
  28.  
Success #stdin #stdout 0.04s 9352KB
stdin
Standard input is empty
stdout
a = 1
b = 2
c = 3

a = 1
b = 2
c = 3
d = 4
e = 5