class A(object): attr = ['class list'] class B(A): pass b = B() print('b.attr before: ', b.attr) b.attr.append('new element') print('b.attr after: ', b.attr) bb = B() print('bb.attr: ', bb.attr)
Standard input is empty
b.attr before: ['class list'] b.attr after: ['class list', 'new element'] bb.attr: ['class list', 'new element']