Xiaowu Zhang
authored
Before this change, class hierarchy is like this when using mixin: ``` class MyClass(BaseClass, Mixin1....) ``` which is usually ok when classes don't override each other's But if we want to overwrite BaseClass's method by using mixin to do more thing, For example: ``` class BaseClass(object): def test(self): print 'base test' class Mixin1(object): def test(self): super(Mixin,self).test() print 'mixin' ``` I want to display 'mixin base test' when call test, but it doesn't work since priority of how methods are resolved is from left to right: BaseClass----->Mixin1, it only display 'base test' So the correct way to use mixin should be in reverse order: ``` class MyClass(Mixin1, BaseClass) ``` /reviewed-on nexedi/erp5!935
Name | Last commit | Last update |
---|---|---|
bt5 | ||
erp5 | ||
product | ||
scalability_test | ||
slapos | ||
tests | ||
.gitignore | ||
.gitmodules | ||
CHANGES.erp5.util.txt | ||
MANIFEST.in | ||
Products | ||
README.erp5.util.txt | ||
setup.py |