method-resolution-order

Method Resolution Order (MRO) in new-style classes?

僤鯓⒐⒋嵵緔 提交于 2019-11-25 23:39:42
问题 In the book Python in a Nutshell (2nd Edition) there is an example which uses old style classes to demonstrate how methods are resolved in classic resolution order and how is it different with the new order. I tried the same example by rewriting the example in new style but the result is no different than what was obtained with old style classes. The python version I am using to run the example is 2.5.2. Below is the example: class Base1(object): def amethod(self): print \"Base1\" class Base2