shared [def __init__(self)self perobj [class attribute instance attribute ( ( sharedy perobj ([][]two instances implicitly share class attrs shared append('spam' perobj append('spam' sharedx perobj (['spam']['spam']impacts ' view tooimpacts ' data only sharedy perobj (['spam'][] shared ['spam' sees change made through stored on class and shared this effect is no different than many we've seen in this book alreadymutable objects are shared by simple variablesglobals are shared by functionsmodule-level objects are shared by multiple importersand mutable function arguments are shared by the caller and the callee all of these are cases of general behavior--multiple references to mutable object--and all are impacted if the shared object is changed in place from any reference herethis occurs in class attributes shared by all instances via inheritancebut it' the same phenomenon at work it may be made more subtle by the different behavior of assignments to instance attributes themselvesx shared append('spam' shared 'spamchanges shared object attached to class in place changed or creates instance attribute attached to but againthis is not problemit' just something to be aware ofshared mutable class attributes can have many valid uses in python programs multiple inheritanceorder matters this may be obvious by nowbut it' worth underscoringif you use multiple inheritancethe order in which superclasses are listed in the class statement header can be critical python always searches superclasses from left to rightaccording to their order in the header line for instancein the multiple inheritance example we studied in suppose that the super class implemented __str__ methodtooclass listtreedef __str__(self)class superdef __str__(self)class sub(listtreesuper) advanced class topics get listtree' __str__ by listing it first