fork download
  1. class A(object):
  2. attr = ['class list']
  3.  
  4. class B(A): pass
  5.  
  6.  
  7. b = B()
  8. print('b.attr before: ', b.attr)
  9. b.attr.append('new element')
  10. print('b.attr after: ', b.attr)
  11.  
  12. bb = B()
  13. print('bb.attr: ', bb.attr)
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
b.attr before:  ['class list']
b.attr after:  ['class list', 'new element']
bb.attr:  ['class list', 'new element']