The basic distinction between resolution order for legacy vs new-style classes comes when the same parent class occurs more than once in the "naive", depth-first approach -- e.g., consider a "diamond inheritance" case:
>>> class A: x = 'a'
...
>>> class B(A): pass
...
>>> class C(A): x = 'c'
...
>>> class D(B, C): pass
...
>>> D.x
'a'
In the above code, legacy-style, the resolution order is D - B - A - C - A: so when viewing up D.x, A is the first base in resolution order to explain it, thereby hiding the definition in C. While:
>>> class A(object): x = 'a'
...
>>> class B(A): pass
...
>>> class C(A): x = 'c'
...
>>> class D(B, C): pass
...
>>> D.x
'c'
>>>
#here, new-style, the order is:
>>> D.__mro__
(<class '__main__.D'>, <class '__main__.B'>, <class '__main__.C'>,
<class '__main__.A'>, <type 'object'>)
with A forced to come in resolution order only once and after all of its subclasses, so that overrides actually work normally.
Are you interested to learn Python in detail? Sign up for this perfect Python Training course by Intellipaat.