class depositcharge(object)fee def deposit_fee(self)self withdraw(self feeclass withdrawcharge(object)fee def withdraw_fee(self)self withdraw(self feeclass using multiple inheritance class mostevilaccount(evilaccountdepositchargewithdrawcharge)def deposit(self,amt)self deposit_fee(super(mostevilaccount,selfdeposit(amtdef withdraw(self,amt)self withdraw_fee(super(mostevilacount,selfwithdraw(amtwhen multiple inheritance is usedattribute resolution becomes considerably more complicated because there are many possible search paths that could be used to bind attributes to illustrate the possible complexityconsider the following statementsd mostevilaccount("dave", , deposit_fee(calls depositcharge deposit_fee(fee is withdraw_fee(calls withdrawcharge withdraw_fee(fee is ?in this examplemethods such as deposit_fee(and withdraw_fee(are uniquely named and found in their respective base classes howeverthe withdraw_fee(function doesn' seem to work right because it doesn' actually use the value of fee that was initialized in its own class what has happened is that the attribute fee is class variable defined in two different base classes one of those values is usedbut which one(hintit' depositcharge fee to find attributes with multiple inheritanceall base classes are ordered in list from the "most specializedclass to the "least specializedclass thenwhen searching for an attributethis list is searched in order until the first definition of the attribute is found in the examplethe class evilaccount is more specialized than account because it inherits from account similarlywithin mostevilaccountdepositcharge is considered to be more specialized than withdrawcharge because it is listed first in the list of base classes for any given classthe ordering of base classes can be viewed by printing its _mro_ attribute here' an examplemostevilaccount _mro_ (in most casesthis list is based on rules that "make sense "that isa derived class is always checked before its base classes and if class has more than one parentthe parents are always checked in the same order as listed in the class definition howeverthe precise ordering of base classes is actually quite complex and not based on any sort of "simplealgorithm such as depth-first or breadth-first search insteadthe ordering is determined according to the linearization algorithmwhich is described in the paper " monotonic superclass linearization for dylan( barrettet alpresented at lib fl ff